[英]How to add cache-control header for all S3 objects of a same content type?
For a S3 bucket, I want my all .jpg objects from Cloudfront (ie '.jpg' objects having Cloudfront URL) get served from disk / memory cache. 对于S3存储桶,我希望从磁盘/内存缓存中获取来自Cloudfront的所有.jpg对象(即具有Cloudfront URL的'.jpg'对象)。
I can't go with the way of adding cache-control header or expires header in S3 object's properties - metadata by visiting each of them, because I have more than 100k .jpg files in whole bucket. 我无法通过在每个S3对象的属性中添加缓存控制标头或使标头过期的方式来访问元数据,因为我在整个存储桶中有超过100k个.jpg文件。
To add this cache control header to all objects - one of my colleagues had ran some script by S3 browser and due to this file type has changed to 'binary/octet-stream'. 为了将此缓存控制标头添加到所有对象,我的一位同事已通过S3浏览器运行了一些脚本,并且由于此文件类型已更改为“二进制/八位字节流”。 The script/command he ran I guess it's something like- 他运行的脚本/命令我想这就像-
./s3cmd --recursive modify --add-header="Cache-Control:public ,max-age= 31536000" s3://your_bucket_name/
So, now I want to avoid these incorrect changes and with that also want to set caching for only '.jpg' objects/files and not all objects from bucket. 因此,现在我要避免这些不正确的更改,并且还希望仅针对“ .jpg”对象/文件而不是存储桶中的所有对象设置缓存。
How can I do that? 我怎样才能做到这一点? The server I am using is Litespeed and not Apache. 我使用的服务器是Litespeed,而不是Apache。
尝试在命令中添加--include "*.jpg" --exclude "*.*"
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.