Reputation: 53
In order to use GCP CDN, I need to set metadata (cache-control) for all the objects in a bucket. Do we have a command to do it?
Upvotes: 3
Views: 4127
Reputation: 624
Yes, you can do it using Cloud Shell and gsutil setmeta
:
1) Open Cloud Shell in Cloud Console.
2) If you want to set cache-control to "public" then execute in Cloud Shell: gsutil setmeta -h "Cache-Control:public" gs://<YOUR-BUCKET-NAME>/*.*
Just use the correct bucket name where you want to apply the update. The setmeta documentation is here. You can change the right file extension (eg. ".html") based on the files type you want to update.
Upvotes: 8