Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

apple-app-site-association to return as application/JSON from a azure request

I have the following requirement,

When an URL is requested in the azure web site for a file, then the file available in root folder has to return to "application/JSON"

Say for example:

I have a file called "apple-app-site-association", which is a text file which has JsonData available in the root folder of a web site in azure. When we enter the URL in browser "mydomain.com\appleConfiguration", that should return the JSON text in the browser.

The file "apple-app-site-association" should not have the extension of ".Json"

I tried using the following ruleset in the web.config, believe the rule set is not accurate, can some one suggest this.

This works fine in IIS but not in Azure hosted site.

 <rule name="Apple Universal Links" stopProcessing="true">
          <match url="^apple-app-site-association$"/>
          <action type="Redirect"  redirectType="application/json" url="^apple-app-site-association$"/>
         </rule>
like image 798
Ipsita Sethi Avatar asked Mar 27 '17 17:03

Ipsita Sethi


1 Answers

Follow the simple five steps to make this working,

1) Create the "apple-app-site-association" with the mobile configuration JSON content and store to the local system.

Sample configuration in the file "apple-app-site-association":

{
    "applinks": {
        "apps": [],
        "details": [
            {
                "appID": "9JA89QQLNQ.com.apple.wwdc",
                "paths": [ "/wwdc/news/", "/videos/wwdc/2015/*"]
            },
            {
                "appID": "ABCD1234.com.apple.wwdc",
                "paths": [ "*" ]
            }
        ]
    }
}

2) Copy the.Json file to your root directory of the azure folder "wwwroot"

3) If the json file is not available or protected to read in your website, then use the mime configuration to enable the .json file to display in the web site

<staticContent> 
          <mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent> 

4) Create a rule in the "web.config" file, which will provide the Json value when the Applebot robot crawl your site for the apple association

<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>




</system.webServer> 

5) Check the Json value is displayed in your web site properly, when you enter the following URL in browser,

https://yourDomain/apple-app-site-association

or

http://branch.io/resources/aasa-validator/

Note: Modify the with valid website Domain name.

if this works fine then Go to the validator site

https://search.developer.apple.com/appsearch-validation-tool

Check the Universal links are valid for your web site.

enter image description here

like image 166
BHUVANESH MOHANKUMAR Avatar answered Sep 27 '22 23:09

BHUVANESH MOHANKUMAR