【发布时间】:2018-04-15 22:30:35
【问题描述】:
我试图让我的 Angular 应用程序的索引页不被缓存。我已经根据this post 格式化了我的 firebase.json 规则:
{
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
},
"functions": {
"predeploy": "npm --prefix functions run build"
},
"hosting": {
"public": "dist",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
],
"headers" : [{
"source": "/**",
"headers": [
{
"key": "Cache-Control",
"value": "no-cache, no-store, must-revalidate"
}
]
},
{
"source":
"**/*.@(jpg|jpeg|gif|png|svg|js|css|eot|otf|ttf|ttc|woff|font.css)",
"headers": [
{
"key": "Cache-Control",
"value": "max-age=604800"
}
]
}]
},
"storage": {
"rules": "storage.rules"
}
}
如果我检查浏览器控制台,规则似乎工作正常:
但是,它仍在加载陈旧的文件,我需要重新加载才能看到更改。知道可能是什么问题吗?
【问题讨论】:
标签: angular firebase firebase-hosting