Reputation: 43
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?
Upvotes: 4
Views: 3377
Reputation: 2393
In our case we were updated using the google cloud storage console GUI. If someone is doing the same then the steps you need to follow are:
1.jpg
in the image belowmake it public now, if the url is already cached, you can append some parameters like http://your.complete.url/1.jpg?abc=1
you can append any paramater as long as syntax is correct.
Everytime you update the object these steps need to be followed
Upvotes: 2
Reputation: 458
I was coming across this same issue while serving up profile images for my users. I fixed this by chaining ?ignoreCache=1
onto the public url.
Upvotes: 4
Reputation: 1524
You can set the cache-control
when you are uploading the object:
Using gsutil
when
gsutil -D -h Cache-Control:"Cache-Control:private, max-age=0, no-transform" cp file gs://BUCKET/file
gsutil set meta
gsutil setmeta -h Cache-Control:"Cache-Control:private, max-age=0, no-transform" gs://BUCKET/file
Or through the console:
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
Upvotes: 1
Reputation: 12145
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.
Upvotes: 4