[英]GCP cloud storage still caches public object after specifying cache-control header
I am using the cloud storage REST api to upload the image to the bucket, which is public to allUsers.我正在使用云存储 REST api 将图像上传到对所有用户公开的存储桶。 When uploading a different image with the same object name it overwrites it on GCP, but the public link still displays the old object. I tried setting the Cache-Control header of the request to "no-store", but the problem still persisted.当上传具有相同 object 名称的不同图像时,它会在 GCP 上覆盖它,但公共链接仍然显示旧的 object。我尝试将请求的 Cache-Control header 设置为“no-store”,但问题仍然存在。 The metadata of the object (on the GCP UI) shows no field supplied in the Cache-Control. object 的元数据(在 GCP UI 上)显示 Cache-Control 中没有提供任何字段。 How can I force it to refresh the file at once?我怎样才能强制它立即刷新文件?
As per this cache directives for no - store A response with no-store isn't cached.根据此缓存指令no - store 不缓存带有 no-store 的响应。 This can be overridden on a per-backend basis with the FORCE_CACHE_ALL cache mode.这可以用 FORCE_CACHE_ALL 缓存模式在每个后端基础上覆盖。
By default, when the entire bucket is public, or the individual objects are public and the individual objects don't specify Cache-Control metadata, Cloud Storage assigns a Cache-Control: public, max-age=3600 header to the object. You can set different values by using Cache-Control metadata .默认情况下,当整个存储桶是公共的,或者单个对象是公共的并且单个对象没有指定 Cache-Control 元数据时,Cloud Storage 分配一个 Cache-Control: public, max-age=3600 header 到 object。你可以通过使用Cache-Control 元数据设置不同的值。 By setting the max age value less this may help you in resolving your issue.通过减少最大年龄值,这可能会帮助您解决问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.