firebase.json中的缓存控制标头不起作用

问题描述 投票:11回答:1

我的Cache-Control中的firebase.json标头似乎不起作用。所有文件的max-age值均设置为31536000(1年),但是在加载页面时,仍将其设置为浏览器默认值3600(1小时)。

firebase.json文件似乎遵守firebase documentation.

{
    "hosting": {
        "public": "public"
    },
    "ignore": [
        "firebase.json",
        "**/.*",
        "**/node_modules/**"
    ],
    "headers": [{
        "source": "**",
        "headers": [{
            "key": "Cache-Control",
            "value": "max-age=31536000"
        }]
    }]
}
json caching firebase cache-control firebase-hosting
1个回答
15
投票
主机键。

这必须工作:

{ "hosting": { "public": "app", "ignore": [ "firebase.json", "**/.*", "**/node_modules/**" ], "headers": [{ "source" : "**", "headers" : [{ "key" : "Cache-Control", "value" : "max-age=31536000" }] }] } }
© www.soinside.com 2019 - 2024. All rights reserved.