I have moved 20000 files to AWS S3 by s3cmd command. Now i want to add cache-control for all images (.jpg)
These files are located in ( s3://bucket-name/images/ ). How can i add cache-control for all images by s3cmd or is there any other way to add header ?
Thanks
To use cache-control in HTML, you use the meta tag, e.g. The value in the content field is defined as one of the four values below. HTTP 1.1. Allowed values = PUBLIC | PRIVATE | NO-CACHE | NO-STORE.
Using the S3 interface it's easy to control cache headers, you just need to go into your bucket, find the file you are concerned with, go to Properties > Metadata and then set what you want. The “key” will be Cache-Control and the value will be the expiry time in seconds.
Please try the current upstream master branch (https://github.com/s3tools/s3cmd), as it now has a modify
command, used as follows:
./s3cmd --recursive modify --add-header="Cache-Control:max-age=86400" s3://yourbucket/
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