0
votes

I have a bucket with READ permission to allUsers and it's working fine but the public url link https://storage.googleapis.com/example_bucket/example.png takes ages to update: if I change the image in storage for a different one with the same name, the bucket view shows the correct image as well as the not public image url https://storage.cloud.google.com/example_bucket/example.png however the public url shows the old image and it takes a long time to update. Could someone explain if this is normal or if I'm doing something wrong?

2
did you happen to find the solution? if any of the the answers provided was useful or the solution, please upvote it or accept it. - Joss Baron

2 Answers

1
votes

You can set the cache-control when you are uploading the object:

Using gsutil when

  1. Uploading

gsutil -D -h Cache-Control:"Cache-Control:private, max-age=0, no-transform" cp file gs://BUCKET/file

  1. Editing: gsutil set meta

gsutil setmeta -h Cache-Control:"Cache-Control:private, max-age=0, no-transform" gs://BUCKET/file

Or through the console:

enter image description here

Currently, there is no way to set a default cache-control for the bucket.

You might be interested in taking a look into this Viewing / Editing Metadata

0
votes

Objects created with READ permission to allUsers by default are served with cache-control: public, max-age=3600. With this cache-control in place updates to the object could not be reflected at caches for an hour.