0
votes

I use Google Cloud Storage as CDN to deliver my static files on on webpages faster. After uploading a new file I set the public cache to one year:

gsutil setmeta -h "Cache-Control:public, max-age=31536000" -r gs://my-bucket

If I update a file Google delivers still the old version. How am I able to clear the cache to get the new file? I access the files through https://my-bucket.storage.googleapis.com

Thanks

1

1 Answers

0
votes

as I can see you are enabling caching for 1 year. there is no way to force cached objecs to expire globaly and even if you update a file, you will still get the cached version (unless you refresh the cache in the browser).

I suggest that you decrease the caching lifetime unless your files rarely change then year would make sense otherwise it's not a good idea.

notice that you can always disable the cache by running:

gsutil -h "Cache-Control:no-cache,max-age=0" \
       cp -a public-read file.png gs://your-bucket

please, look at this documentation for more info