After last blog entry, I notice my live website is not automatically updated. The content in Google Cloud Storage is updated and I can access my last post using URL directly. But my website still showing the old main page. Some googling later I found out there is a cache for Google Cloud Storage. If I create a file for download in Google Cloud Storage and on the next day I update it. The change won’t be applied to the user directly. By using default value, it will apply the change in 1 hour. To remove the cache, we need to change a metadata settings in the file. Below is the metadata we need to change:
Cache-Control: no-cache, max-age=0
After the change in index.html and a refresh, I could see my latest post on my live website. The problem is we need to change the attribute everytime we upload a new main page file (index.html). Below is the gsutil command to change the mainpage metadata:
gsutil setmeta -h "Cache-Control:no-cache,max-age=0" gs://www.henthom.com/index.html
So I create a batch file to do this task. Tomorrow I will create a blog regarding batch file I use to automate publishing this website task.