Serving apple-app-site-association file for Apple Universal links

Serving apple-app-site-association file for Apple Universal links

Serving apple-app-site-association file for Apple Universal links 150 150 Benjamin Durin

An iOS app I am writing an API for is using Apple Universal links. For this feature to work, the server must serve a JSON file called apple-app-site-association but without an extension.

Problem: NGINX serves this file as application/octet-stream while iOS is expecting an application/json MIME type.

I tried forcing the type for this file in the config file but nothing that I googled worked.

Finally I decided to rename the file to apple-app-site-association.json in order to have the correct MIME type automatically set, but knowing that iOS would take nothing of that I added a rewrite rule. This rewrite rule serves the apple-app-site-association.json file when the apple-app-site-association file is requested:

rewrite /.well-known/apple-app-site-association /.well-known/apple-app-site-association.json;

Privacy Preferences

When you visit our website, it may store information through your browser from specific services, usually in the form of cookies. Here you can change your Privacy preferences. It is worth noting that blocking some types of cookies may impact your experience on our website and the services we are able to offer.

Our website uses cookies, mainly from 3rd party services. Define your Privacy Preferences and/or agree to our use of cookies.