cloudflarecloudflare-r2

Can we set Cloudflare R2 cache-control max-age?


Can we set the Cache-Control HTTP response header for our Cloudflare R2 buckets & objects? I could not find options in the web UI nor the AWS CLI "s3" and "s3api" commands. I'm now convinced Cloudflare looses money if we can use Cache-Control headers to limit the number of requests to their servers 🙃.


Solution

  • The s3api provides the --cache-control option for commands: