Firebase 托管自定义标头不起作用

314*_*ple 7 http-headers firebase firebase-hosting

我在 Firebase 托管上部署了一个静态站点,并带有一些标头配置。但是我的一些标题在站点部署后没有出现。

我尝试更改Cache-Controlheader的值并且它有效。但是X-Frame-OptionsContent-Security-PolicyX-Content-Type-Options没有。

firebase.json:

{
    "hosting": {
        "public": "public",
        "ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
        "headers": [
            {
                "source": "**/*.@(html)",
                "headers": [
                    {
                        "key": "Cache-Control",
                        "value": "max-age=3600"
                    },
                        {
                        "key": "X-Frame-Options",
                        "value": "SAMEORIGIN"
                    },
                    {
                        "key": "Content-Security-Policy",
                        "value":
                            "script-src 'self' 'unsafe-inline' cdnjs.cloudflare.com; style-src 'self' 'unsafe-inline' cdnjs.cloudflare.com"
                    }
                ]
            },
            {
                "source": "**/*.@(jpg|jpeg|gif|png|ico|svg)",
                "headers": [
                    {
                        "key": "Cache-Control",
                        "value": "max-age=2592000"
                    }
                ]
            },
            {
                "source": "**/*.@(js|css)",
                "headers": [
                    {
                        "key": "Cache-Control",
                        "value": "max-age=2592000"
                    }
                ]
            },
            {
                "source": "**/*",
                "headers": [
                    {
                        "key": "X-Content-Type-Options",
                        "value": "nosniff"
                    }
                ]
            }
        ]
    }
}
Run Code Online (Sandbox Code Playgroud)

我得到的实际响应标头:

实际响应头

Vla*_*oka 0

部署后,请确保清除浏览器的缓存或使用隐身模式。这就是我遇到的情况,我的自定义标头没有显示,因为 Chrome 缓存了之前部署的版本