当您重新删除云运行中的Web应用程序时,是否有必要更新Firebase,您是否可以控制重新部署期间从缓存中删除的内容?
使用 firebase + 云运行部署 Web 应用程序后,firebase 配置通常不会发生太大变化。
问题1
是否建议更新云运行容器而不执行 在 firebase 上重新部署?
使用云运行更新 Firebase 的建议方法是什么?假设不想丢失 Firebase 上已有的缓存。根据 firebase 的说法,重新部署 Web 应用程序会清除所有 CDN 缓存。
问题 2
这是我的情况
我有一个 Web 应用程序托管在 cloud run + firebase 上,每当我进行重新部署时,我想要从 CDN 的 API 缓存的任何内容 >不被清除。剩下的就可以清除了。
有没有办法控制在期间从缓存中清除的内容 重新部署?
这是我的配置
{
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [ {
"source": "**",
"run": {
"serviceId": "my-site",
"region": "some-region"
}
} ],
"headers": [{
"source" : "**",
"headers" : [
{
"key" : "Cache-Control",
"value" : "max-age=31536000"
}
]
}]
}
}
After deploying a web app with firebase + cloud run the firebase configurations usually don't change much.
Question 1
Is it advisable to update the cloud run container without doing a
re-deployment on firebase ?
What's the advisable way to update firebase with cloud run let's say don't want to lose cache already on firebase. According to firebase a re-deployment of the web app clears all CDN cache.
Question 2
Here is my situation
I have a web app hosted on cloud run + firebase whenever I do a re-deployment I want whatever is cached from my API's from CDN not to be cleared. The rest can be cleared.
Is there a way to control what's cleared from cache during
re-deployments ?
Here is my configurations
{
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [ {
"source": "**",
"run": {
"serviceId": "my-site",
"region": "some-region"
}
} ],
"headers": [{
"source" : "**",
"headers" : [
{
"key" : "Cache-Control",
"value" : "max-age=31536000"
}
]
}]
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
每当您更新云运行容器时,更改将不会更新到firebase,如果您希望将更改更新为firebase托管,则应考虑部署到firebase
firebase deplotion-仅托管
。根据 doc
例如,如果您有动态内容,则可以通过admin UI编辑。请注意,CDN缓存将保留该内容的陈旧缓存,直到其到期为止。
例如:CDN CACHES /BLOB /SONE SONE-STOST,S-MAXAGE为1天。即使您动态地更改帖子的内容,CDN也将使CDN整天保持一整天,直到它到期并再次请求。
Whenever you update the Cloud Run container, the changes will not be updated to the Firebase, if you want the changes to be updated to the Firebase hosting then you should consider deploying to the Firebase
firebase deploy --only hosting
.According to the doc
If you have dynamic content that you'll edit through an admin UI, for example. Be aware that the CDN cache will keep stale cache of that content until it expires.
For example: CDN caches /blog/some-post with s-maxage of 1 day. Even if you change the content of your post dynamically, the CDN will keep the CDN for 1 full day, until it expires and it gets requested again.