cuibonobo / terra-incognita

A sort of luminous, geometric, incandescent immensity.
Creative Commons Zero v1.0 Universal
0 stars 0 forks source link

Set `Cache-Control` and other metadata when uploading a file #2

Closed cuibonobo closed 2 years ago

cuibonobo commented 2 years ago

The b2_upload_file operation allows up to 10 X-Bz-Info-* headers. One of them can be X-Bz-Info-b2-cache-control for setting Cache-Control for individual files. However, if I can set this at the bucket-level that would be a better option.

cuibonobo commented 2 years ago

Cache-Control policies for the entire bucket can be set with b2_update_bucket. The bucket info can also be changed in the UI under Bucket Settings > Bucket Info. I've set it to {"cache-control": "max-age=31536000"} so that images are cached for a year.

cuibonobo commented 2 years ago

Done.