【问题标题】:Set file MIME type on Firebase Hosting在 Firebase 托管上设置文件 MIME 类型
【发布时间】:2016-07-27 17:26:10
【问题描述】:

我正在 iOS 9+ 上实现通用链接,并尝试将 apple-app-site-association 文件添加到我的 Firebase 托管根目录:

https://developer.apple.com/library/ios/documentation/Security/Reference/SharedWebCredentialsRef/

如果您的应用在 iOS 9 及更高版本中运行并且您使用 HTTPS 来提供文件,您可以创建一个使用 application/json MIME 类型的纯文本文件,并且您不需要对其进行签名。

如何将 MIME 类型设置为“application/json”?看起来文档没有将此列为可能的内容类型。

【问题讨论】:

    标签: ios firebase firebase-hosting


    【解决方案1】:

    Google Firebase 托管已更新为包含此内容类型。只需将声明添加到您的应用配置 firebase.json。

    【讨论】:

      【解决方案2】:

      像这样更新您的 Firebase 托管配置文件“firebase.json”;您也可以提供内容类型、响应代码。

        "functions": {
          "predeploy": [
            "npm --prefix \"$RESOURCE_DIR\" run lint",
            "npm --prefix \"$RESOURCE_DIR\" run build"
          ]
        },
        "hosting": {
          "public": "dist/my_app",
          "ignore": [
            "firebase.json",
            "**/node_modules/**"
          ],
          "rewrites": [
            {
              "source": "**",
              "destination": "/index.html"
            },
            {
      
              "source": "/.well-known/assetlinks.json",
              "destination": "/.well-known/assetlinks.json",
              "content-type": "application/json",
              "code":200
            }
      
          ]
      }
      }
      
      
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-01-20
        • 2015-03-01
        • 1970-01-01
        • 2016-08-01
        • 2015-06-14
        • 2018-01-08
        • 2010-11-01
        相关资源
        最近更新 更多