How to set content / mime type of apple-app-site-association as application/json

3.6k views Asked by At

I am trying to setup universal app links for my app and am trying to upload the apple-app-site-association to the server at "/" and "/.well-known " locations but when I navigate to it I get a 404 error.

The mime type is not application/json when I try to create one it always reverts back to type text and not application/json.

I do not have access to Virtual Hosts/Apache Settings on Plesk for the server nor do I have access to the etc/sites-available to set content-type of the file.This is my reference https://gist.github.com/anhar/6d50c023f442fb2437e1#modifying-the-content-type.

The contents of my file are

{
    "applinks": {
        "apps": [],
        "details": [
            {
                "appID": "XXXXX.com.domain.appname",
                "paths": [
                    "*"
                ]
            }
        ]
    }
}

Please help.

1

There are 1 answers

0
christmas On BEST ANSWER

The server provided by the client is IIS so I had to upload a json file apple-app-site-association.json, and put in a rewrite rule in web.config file ,found at root,

<rewrite>
        <rules>
            <rule name="apple_json_file">
                <match url="^apple-app-site-association" />
                <action type="Rewrite" url="apple-app-site-association.json" />

            </rule>
        </rules>
    </rewrite>

Did the trick for me.