Google Cloud CDN开始忽略存储桶的查询字符串 [英] Google Cloud CDN started ignoring query strings for storage buckets

查看:135
本文介绍了Google Cloud CDN开始忽略存储桶的查询字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几个月前,为存储桶激活了Cloud CDN.我们的存储数据会定期通过后端进行更改.因此,为了使缓存版本无效,我们在提供给客户端的url中添加了changedDate的查询参数.

Some months ago activated Cloud CDN for storage buckets. Our storage data is regularly changed via a backend. So to invalidate the cached version we added a query param with the changedDate to the url that is served to the client.

那时候效果很好.

过去几个月(大概数周)的某个时候,Google似乎已经改变了这种情况,现在忽略了从存储桶中进行缓存的查询字符串.

Sometime in the last months (probably weeks) Google seemed to change that and is now ignoring the query string for caching from storage buckets.

  • 第一部分:有谁知道为什么更改了它,为什么没人 收到通知吗?
  • 第二部分:如何使特定对象的缓存无效 在存储桶中而不发送缓存无效请求 (您不应该)每次?
  • First part: Does anyone know why this is changed and why noone was notified about it?
  • Second part: How can you invalidate the Cache for a particular object in a storage bucket without sending a cache-invalidation request (which you shouldn't) everytime?

我不喜欢每次上传文件时删除旧文件并上传文件名已更改的新文件的想法...

I don't like the idea of deleting the old file and uploading a new file with changed filename everytime something is uploaded...

为了澄清:官方文档(cloud.google.com/cdn/docs/caching)已经声明他们现在忽略存储桶的查询字符串:

for clarification: the official docu ( cloud.google.com/cdn/docs/caching ) already states that they now ignore query strings for storage buckets:

对于后端存储桶,缓存键由不带查询>字符串的URI组成.因此 https://example.com/images/cat.jpg https://example.com/images/cat.jpg?user=user2 是等效.

推荐答案

我们也受到了这一影响.与Google支持人员联系后,他们已经确认这是永久更改.推荐的解决方法是在对象名称中使用版本控制,或使用缓存无效化.后者听起来有些奇怪,因为缓存失效文档指出:

We were affected by this also. After contacting Google Support, they have confirmed this is a permanent change. The recommended work around is to either use versioning in the object name, or use cache invalidation. The latter sounds a bit odd as the cache invalidation documentation states:

无效是为在特殊情况下使用而设计的,而不是正常工作流程的一部分.

Invalidation is intended for use in exceptional circumstances, not as part of your normal workflow.

这篇关于Google Cloud CDN开始忽略存储桶的查询字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆