4

I have hosted a Website in the Google Cloud storage. Its has only static files. All are working good. I have changed few pages and uploading those files back to Cloud storage. It is successfully uploaded. But those changes are not reflecting while accessing through the browser immediately. It works after some time. I couldn't find the time pattern after when it reflects.

Could any one know how to reflect the changes immediately in the browser.

I have cleared all the cache and cookies. I have used control+F5 to refresh the page but it is not working. I have tested both Firefox and Chrome. Both behaves same.

I have copied the headers content below,

Request Headers

User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Connection: keep-alive Upgrade-Insecure-Requests: 1 Pragma: no-cache Cache-Control: no-cache

Response Headers

X-GUploader-UploadID: AEnB2UpLL0HQXX5kBesLWzBDywY7Wyry1yA7WjPEnQT0YtH-Jg4PHl5kBHAGjqiATWSZ1-AJKX9IsrPbzP4lUZvtF2IAvbqxhA Expires: Mon, 08 May 2017 16:59:50 GMT Date: Mon, 08 May 2017 15:59:50 GMT Last-Modified: Mon, 08 May 2017 15:53:53 GMT Etag: "af73f0909ae13b8cc6298d8a58640046" x-goog-generation: 1494258833242504 x-goog-metageneration: 1 x-goog-stored-content-encoding: identity x-goog-stored-content-length: 24795 x-goog-meta-goog-reserved-file-mtime: 1494258821 Content-Type: text/html Content-Language: en x-goog-hash: crc32c=fOshiQ==, md5=r3PwkJrhO4zGKY2KWGQARg== x-goog-storage-class: REGIONAL Accept-Ranges: bytes Content-Length: 24795 Server: UploadServer Cache-Control: public, max-age=3600 Age: 2128

2 Answers2

7

By default, Google itself caches publicly readable objects for up to an hour. Flushing your local cache won't help. You can change this behavior by specifying a specific cache control policy when uploading an object. You can also change this property after the fact, but it won't remove the object from the cache until the hour runs out.

You can also download the new version of the object by explicitly specifying its generation, or by appending some nonsense query parameter to the URL, like ?skipCache=1234.

Brandon Yarbrough
  • 37,021
  • 23
  • 116
  • 145
-1

See Related Google cloud storage: How can I reset edge cache?

Hope helps

danipenaperez
  • 583
  • 5
  • 12
  • Do you have an actual source for this claim? Caching is controlled by the browser and CDN, not by GCS. Adding the arbitrary query parameter as you suggest only seems to cache a new resource at the URL with the query parameter, which then continues to be reused just as before. – Will Chen May 11 '21 at 22:48
  • Hi will, yes ingoreCache is only a random parameter to generate new URL resource as you said. It is a workaround suggested. Edit my response to link other related Stack Overflow question. – danipenaperez May 13 '21 at 06:31