Firebase托管mime类型

Ale*_*lex 5 firebase-hosting

有没有人找到一种方法来设置使用Firebase Hosting托管文件时在Content-Type标头中返回的mime类型?文档说他们支持他们的规则文件中的一些标题,但不支持内容类型,我仍然绑它但是由于错误'hosting.headers [0]而导致'firebase deploy'失败..headers [0] .key不是枚举值'.此外,我需要提供的文件不能有扩展,这使firebase更难以自动发现文件的类型.

fas*_*tar 6

我测试了它,它似乎工作.另外,对于你的第二个问题,为什么不设置扩展,但是改为你需要的mimetype?

{
  "database": {
    "rules": "database.rules.json"
  },
  "hosting": {
    "public": "public",    
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ],
    "headers": [
      {
        "source": "**/*.@(datagz|memgz|mem|data)",
        "headers": [
          {
            "key": "Content-Type",
            "value": "application/octet-stream"
          }
        ]
      } 
    ]
  }
}
Run Code Online (Sandbox Code Playgroud)