firebase.json文件中的Cache-Control标头不起作用

Pra*_*gla 10 json caching cache-control firebase firebase-hosting

Cache-Control我的firebase.json文件中的标头设置似乎不起作用.我已将max-age所有文件的值设置为31536000(1年).我的firebase.json文件是 -

{
    "hosting": {
        "public": "public"
    },
    "ignore": [
        "firebase.json",
        "**/.*",
        "**/node_modules/**"
    ],
    "headers": [{
        "source": "**",
        "headers": [{
            "key": "Cache-Control",
            "value": "max-age=31536000"
        }]
    }]
}
Run Code Online (Sandbox Code Playgroud)

该文件似乎遵守firebase文档.

但是max-age,对于所有文件,该值仍设置为浏览器默认值3600(1小时).

Cache-Control只需一个小时

Arn*_*las 14

根据整页配置,您必须先设置主机密钥.

这必须工作:

{
  "hosting": {
    "public": "app",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "headers": [{
      "source" : "**",
      "headers" : [{
        "key" : "Cache-Control",
        "value" : "max-age=31536000"
      }]
    }]
  }
}
Run Code Online (Sandbox Code Playgroud)