314*_*ple 7 http-headers firebase firebase-hosting
我在 Firebase 托管上部署了一个静态站点,并带有一些标头配置。但是我的一些标题在站点部署后没有出现。
我尝试更改Cache-Controlheader的值并且它有效。但是X-Frame-Options,Content-Security-Policy,X-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)
我得到的实际响应标头:
| 归档时间: |
|
| 查看次数: |
1554 次 |
| 最近记录: |