【发布时间】:2016-11-21 16:43:13
【问题描述】:
为了为 iOS 应用程序设置通用链接,我创建了一个 apple-app-site-association 文件,并将它放在我的 Rails 应用程序的 /public 目录中。
我可以在正确的地址卷曲它,但它返回错误的内容类型。它返回application/octet-stream,而不是application/json 或application/pkcs7-mime,正如您在此处的响应中看到的那样:
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*"
]
}
]
}
我正在尝试在 nginx 配置中指定 Content-Type:
/etc/nginx/sites/sites-available/sitename:
server {
...
location /apple-app-site-association {
default_type application/pkcs7-mime;
}
}
我已保存此更改并重新启动 nginx。这对 curl 的响应没有任何影响。我还尝试了location /public/apple-app-site-association {} 和其他一些变体,但没有效果。
设置 nginx 以提供具有正确内容类型的文件的正确方法是什么?
【问题讨论】:
标签: ios nginx ios-universal-links