How to set correct content-type for apple-app-site-association file on Nginx/Rails
Add in nginx:
location ~ /.well-known/apple-app-site-association {
default_type application/pkcs7-mime;
}
This worked for me within .htaccess:
<FilesMatch "apple-app-site-association">
ForceType application/json
</FilesMatch>
It turns out the nginx configuration file described two servers, and I was adding the location snippet to the wrong one.
When I added it to the correct one and reloaded nginx, the file was returned with the expected content-type:
HTTP/1.1 200 OK
Server: nginx/1.10.1
Content-Type: application/pkcs7-mime
Content-Length: 245
{
"applinks": {
"apps": [],
"details": [
{
"appID": "APPPREFIX.com.mycompany.app",
"paths": [
"/home*"
]
}
]
}