Firebase托管自定义标头无效

时间:2018-04-04 08:39:20

标签: firebase http-headers firebase-hosting

我在firebase托管上部署了一个静态站点,其中包含一些标头配置。 但是我在部署网站后没有出现一些标题。

我尝试更改Cache-Control标头的值,但它确实有效。 但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"
                    }
                ]
            }
        ]
    }
}

我得到的实际回复标题:

actual response header

0 个答案:

没有答案