Since there is unfortunately no way to set a default cache-control header for a bucket (which there really should be...), is there a way to specify a default cache-control header for the gsutil rsync command? Or barring that, an easy way to programmatically get a list of all the files actually changed during the rsync, that we can pass into the setmeta command?
Since we have quite a few files which change for each deploy, we have to do a setmeta on ** after each deploy, which takes an unreasonable amount of time... but haven't figured out any better way to reliably ensure correct cache-control headers for all files in the cloud storage bucket, since there is no way to set up proper defaults for either the bucket itself or the rsync command. Is there a better way to accomplish this goal? What are we missing?
If you want the same Cache-Control header for all the files you upload, you could use the gsutil -h option to cause the gsutil rsync command to set the Cache-Control headers. Example:
gsutil -m -h "Cache-Control:private, max-age=0, no-transform" rsync -r ./dir gs://my-bucket
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With