Set default meta-data for all future uploaded objects in GCP Bucket

房东的猫 提交于 2021-01-29 10:23:50

问题


I would like to know how could I set default meta-data for all future uploaded objects.

Am trying to set "Cache-Control:public,max-age=3600" as a header for each object in my bucket hosting a static website. For all the existing objects, I used the guide command to set meta data, although, can't find a way to set it by default for future uploaded objects.

P.S., Developers are using GCP console to upload the objects, and I recently realized that when they upload the updated HTML files (which replaces the one's on bucket), the meta-data resets.


回答1:


According to the documentation, if an object does not have a Cache-Control entry, the default value when serving that object would be public,max-age=3600.

In the case that you still want to modify this meta-data, you could do that using the JSON API inside a Cloud Funtion that would be triggered every time a new object is created or an existing one is overwritten.



来源:https://stackoverflow.com/questions/58111385/set-default-meta-data-for-all-future-uploaded-objects-in-gcp-bucket

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!