3

I've been trying to set up deeplinking for our iOS app on iOS9. The first step involves creating a JSON file which I have already done so and then upload it to server. The problem I have is I've uploaded the json file to server at location: https://www.example.com/apple-app-site-association but when I check this URL on browser it is returning 404 File not found error response. I should be able to see it just like on Google's: https://www.google.com/apple-app-site-association

On the Apple Developer docs it says I have to make sure I don't save the file with extension .json so that's why .json extension is not included.

On the docs it says you have to set the file to MIME type application/json. And I believe this must be the issue as I have not done so.

My question is how do I set the MIME type of the file? I know this has to be set up somewhere server side and if it helps we are using the .NET framework for our web-app and server side code. What is the programming code for setting this file to MIME type "application/json" and on which file should this code be placed inside?

Would appreciate anyones help.

Juan Pablo
  • 31
  • 2

1 Answers1

3

You will need to map the apple-app-site-association endpoint to the json file in the root of the website. I achieved this by using a url rewrite in my .webconfig

If you don't have the url rewrite module in IIS you can download it here: http://www.iis.net/downloads/microsoft/url-rewrite

This is my current webconfig:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <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>
        <staticContent>
            <mimeMap fileExtension=".json" mimeType="application/json" />
        </staticContent>

    </system.webServer>
</configuration>

The final part which regards serving mime types maybe unnecessary depending on whether your server already recognizes the .json extension.

CharlieTap
  • 136
  • 3
  • Where is the .webconfig you mention? Is it accessible to users who have sites hosted on GoDaddy - or is this something only IIS admins would have access to? – Praxiteles Jun 15 '16 at 09:58