如何将 apple-app-site-association 的内容/mime 类型设置为 application/json

How to set content / mime type of apple-app-site-association as application/json

我正在尝试为我的应用程序设置通用应用程序链接,并尝试将 apple-app-site-association 上传到位于“/”和“/.well-known”位置的服务器,但是当我导航到我收到 404 错误。

MIME 类型不是 application/json 当我尝试创建一个时,它总是恢复为键入文本而不是 application/json。

我无法访问服务器 Plesk 上的虚拟 Hosts/Apache 设置,也无法访问 etc/sites-available 来设置 file.This 的内容类型是我的参考https://gist.github.com/anhar/6d50c023f442fb2437e1#modifying-the-content-type.

我的文件内容是

{
    "applinks": {
        "apps": [],
        "details": [
            {
                "appID": "XXXXX.com.domain.appname",
                "paths": [
                    "*"
                ]
            }
        ]
    }
}

请帮忙。

客户端提供的服务器是IIS所以我不得不上传一个json文件apple-app-site-association.json,并在web.config文件中放入重写规则,在根目录下找到,

<rewrite>
        <rules>
            <rule name="apple_json_file">
                <match url="^apple-app-site-association" />
                <action type="Rewrite" url="apple-app-site-association.json" />

            </rule>
        </rules>
    </rewrite>

对我有用。