Serving Apple App Site Association file using Nginx for React Apps

Designed by Aarthi

The AASA (short for apple-app-site-association) is a file that lives on your website and associates your website domain with your native app. In other words, it’s a safe way to prove domain ownership to iOS for deep linking.

There is no way to serve the apple-app-site-association from a react app. So we have to push the AASA file from the Nginx server.

Step 1 — Copy the AASA file to the server

I have uploaded the file in the following directory

/var/www/certificates/ios/

Step 2— Add a route to the Nginx config file

cd /etc/nginx/sites-enabled/sudo vim default

Add the following config to the Nginx configuration file above the line where you find this location / {

location /apple-app-site-association {
alias /var/www/certificates/ios/;
index apple-app-site-association.json
autoindex on;
}

Step 3 — Check and Restart the Nginx server

nginx -t

If you get the following output then you are good to go. Else, there is something wrong with your Nginx server configuration.

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Now, restart the Nginx server for the changes to take effect.

sudo service nginx restart

Step 4— Testing the output

https://example.com/apple-app-site-association

The complete default file is given below

Hooray!!, Now you can provide domain ownership for apple using the AASA file.

Say Hi, It’s free at @matheswaaran_S or https://matheswaaran.com

Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store