Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

updated json file not showing in public link

I got some problem when updating my json file which located in a bucket, and will be called by a html page. I will update my json file every 5 minutes from the command line, and this can be done. However, even though the json file itself is updated and set to be public, the public link is still showing the old content not the new content.

If I click the json file, I can see that the content has been changed, but if I click the public link, the content still remains not updated.

Does anybody know how much time it takes for Google Cloud Storage to load the buffer so that the new content will be shown in the public link?

Or is there any method to update the json file and get the public link updating instantly?

Thank you!

like image 736
Haipeng Su Avatar asked Aug 25 '16 18:08

Haipeng Su


1 Answers

By default, publicly visible objects accessed anonymously have a cache-control header set to 1 hour. You can override this when you upload a new object by explicitly setting the cacheControl metadata to something else.

If you're using gsutil to upload the object, you could do it like this:

gsutil -h "Cache-Control:no-cache, max-age=0" \
    cp -a public-read myfile.json gs://mybucket
like image 58
Brandon Yarbrough Avatar answered Oct 18 '22 01:10

Brandon Yarbrough