我有一个使用自定义域名的网络应用。该域的A记录映射到151.101.1.195和151.101.65.195。
一切正常,但是当我有这样的firebase.json时:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
当我访问https://mycustomdomain.com时,我仍然会看到这样的响应标头:
{
"hosting": {
"public": "dist",
"headers": [{
"source": "**/*.html",
"headers": [{
"key": "Cache-Control",
"value": "private, max-age=0, no-cache"
}]
}]
}
}
我希望修改缓存控制标头,但它不会改变。
如何更改域根的响应标头?
答案 0 :(得分:0)
对于任何寻找的人,我最终都是这样做的,而且似乎有效:
{
"hosting": {
"public": "dist",
"headers": [
{
"source": "/",
"headers": [{
"key": "Cache-Control",
"value": "private, max-age=0, no-cache"
}]
},
{
"source": "**/*",
"headers": [{
"key": "Cache-Control",
"value": "private, max-age=0, no-cache"
}]
},
{
"source": "**/*.js",
"headers": [{
"key": "Cache-Control",
"value": "max-age=31536000"
}]
},
{
"source": "**/*.css",
"headers": [{
"key": "Cache-Control",
"value": "max-age=31536000"
}]
},
{
"source": "**/*.jpg",
"headers": [{
"key": "Cache-Control",
"value": "max-age=31536000"
}]
},
{
"source": "**/*.png",
"headers": [{
"key": "Cache-Control",
"value": "max-age=31536000"
}]
}
],
"rewrites": [
{ "source": "/api/1/mina", "function": "mydata" },
{ "source": "**", "destination": "/index.html" }
]
}
}
这也适用于功能。请注意,.js文件也被激活缓存,因为我们使用缓存清除URL。