Reputation: 45224
I run a static website (blog) on Google Cloud Storage.
I need to set a default metadata header for cache-control
header for all existing and future objects.
However, editing object metadata instructions show the gsutil setmeta -h "cache-control: ..." command, which doesn't seem to be neither applying to "future" objects in the bucket, nor giving me a way to set a bucket-wide policy that can be inherited to existing/future objects (since the command is executed per-object).
This is surprising to me because there are features like gsutil defacl
which let you set a policy for the bucket that is inherited by objects created in the future.
Q: Is there a metadata policy for the entire bucket that would apply to all existing and future objects?
Upvotes: 3
Views: 1288
Reputation: 4961
Extracted from this question
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
if the object is publicly readable.
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.
Upvotes: 0
Reputation: 12145
There is no way to set default metadata on GCS objects. You have to set the metadata at write time, or you can update it later (e.g., using gsutil setmeta).
Upvotes: 5