You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm adding cache-control headers to some assets on rednafi.com, like CSS and images, to make them immutable and cache them for a long time. These assets don’t change much, and making them immutable will save on R2 quota since they won't be fetched from the bucket on every request.
Set up Cloudflare Cache in front of the site (already done).
Configure AWS CLI (CF R2 is AWS S3 compatible, so setting this up is easy).
Reupload the targeted assets. You can’t set the cache-control header on an existing object, so reuploading is necessary. This command uploads all files in the ./static/images/home directory to the bucket named blog:
I'm adding cache-control headers to some assets on rednafi.com, like CSS and images, to make them immutable and cache them for a long time. These assets don’t change much, and making them immutable will save on R2 quota since they won't be fetched from the bucket on every request.
cache-control
header on an existing object, so reuploading is necessary. This command uploads all files in the./static/images/home
directory to the bucket namedblog
:aws s3 cp ./static/images/home s3://blog/static/images/home --recursive --metadata-directive REPLACE --cache-control "public, max-age=315360000, immutable" --endpoint-url=https://f2c208344e8adb0cf3ea1e48dccf7218.r2.cloudflarestorage.com
This will return:
It should return:
The text was updated successfully, but these errors were encountered: