How to Quickly Update Static Site on Google Cloud Storage?

时间:2017-08-13 13:57:17

标签: google-cloud-platform google-cloud-storage

I have a static site hosted on google cloud storage. I set it up per the same methodology described here:

https://cloud.google.com/storage/docs/hosting-static-website

I have purchased a domain, and the website is running smoothly on it at this point. I am still in the process of making changes to the content of the site. My current workflow is to edit the files (for example, index.html) locally on my windows machine, and then upload the modified files to my storage bucket using the online console/ storage browser at https://console.cloud.google.com/storage/browser, making sure to set them as public links. I then navigate to my website using chrome to see what changes have occurred.

Most of the time, when I do this, my site appears to be unchanged! I can even inspect the source files for the site and discover that they do not match the files that are currently in my storage bucket. If I wait some time, varying from minutes to hours, the website does eventually change. I would like it to be the case that it changes instantly so I can test changes quickly (I cannot test locally because the framework I am using does not function without running a localhost, which I cannot do). How do I do make my cloud storage static site update quickly?

My best guess for the reasons this might happen are pretty scattershot. Is it that it takes some amount of time for various gcp servers around the world to sync together? Would it have anything to do with the TTL settings or other settings on my domain name registrar? (namecheap, currently using defaults).

1 个答案:

答案 0 :(得分:3)

虽然GCS基础设施内部的变化传播并不是不可能解释您提及的行为,但这种可能性并不大。

你更有可能看到缓存效果。这可能发生:

  • 在Google云中:
  • 在您的浏览器中 - 尝试在部署后清除浏览器的缓存
  • 几乎介于两者之间(你无法控制它)。