How to set correct content-type for apple-app-site-association file on Nginx/Rails
<p>In order to set up universal links for an iOS app, I have created an apple-app-site-association file, and placed it in the /public directory of my Rails app. </p>

<p>I can curl it at the correct address, but it returns the wrong content type. Instead of <code>application/json</code> or <code>application/pkcs7-mime</code> it returns <code>application/octet-stream</code>, as you can see in the response here:</p>

<pre><code>curl -i https://example.com/apple-app-site-association

HTTP/1.1 200 OK
Server: nginx/1.10.1
Content-Type: application/octet-stream
Content-Length: 245
Last-Modified: Mon, 21 Nov 2016 12:45:00 GMT
Strict-Transport-Security: max-age=31536000

{
  "applinks": {
    "apps": [],
    "details": [
      {
        "appID": "APPPREFIX.com.mycompany.app",
        "paths": [
          "/home*"
        ]
      }
    ]
  }
</code></pre>

<p>I am attempting to specify a Content-Type in the nginx configuration: </p>

<pre><code>/etc/nginx/sites/sites-available/sitename: 

server {
   ...
   location /apple-app-site-association {
      default_type application/pkcs7-mime;
   }
}
</code></pre>

<p>I have saved this change and restarted nginx. This doesn't make any difference to the response from curl. I've also tried <code>location /public/apple-app-site-association {}</code> and a few other variations, to no effect.</p>

<p>What is the correct way to set up nginx to deliver this file with the correct content type?</p>