I am trying to use Google Cloud Storage (GCS) to serve static content for a website (e.g. css, js, etc.) So I upload style.css, it serves well - then I do a small modification to style.css, upload it again - GCS still serves the original version...
I tried deleting the file. The link is still there and still serving the original version. I uploaded it again. Still serving the original version....
Google Cloud Storage documentation says that Objects are immutable, but you can replace objects:
However, it is possible to replace objects that are stored in Cloud Storage, and doing so happens atomically: until the new upload completes the old version of the object is served to readers, and after the upload completes the new version of the object is served to readers. So a single replacement operation simply marks the end of one immutable object's lifetime and the beginning of a new immutable object's lifetime.
But this is obviously not working. I am uploading files through the UI (not the CLI).
Help! I am about to get an AWS S3 to store the static contents there, defeats the purpose of using GCP!!!
MPX
When you change to new version you have to remember that there is
Cache-Control metadata
. Browser will show old version until the time set in the value will pass.It's important to remember that
cache-control
has default value 3600 second. So if not set new version of the file will be shown by the browser with delay.Please check documentation for cache-control metadata.