[英]How to use browser caching with Amazon S3?
I get the following on gtmetrix.com: 我在gtmetrix.com上获得以下内容:
Leverage browser caching
E (55)
52%
Server High
What does this mean?
The following cacheable resources have a short freshness lifetime. Specify an expiration at least one week in the future for the following resources:
http://mysite.s3.amazonaws.com/profile.png (expiration not specified)
http://mysite.s3.amazonaws.com/circle.player.css (expiration not specified)
http://mysite.s3.amazonaws.com/main.js (expiration not specified)
http://mysite.s3.amazonaws.com/not.the.skin.css (expiration not specified)
http://cdn-images.mailchimp.com/embedcode/slim-321711.css (expiration not specified)
I'm guessing the mailchimp files can't be modified. 我猜测mailchimp文件无法修改。 But how do I specify a browser cache for Amazon S3 Cloudfront files? 但是,如何为Amazon S3 Cloudfront文件指定浏览器缓存?
When you store files to s3. 将文件存储到s3时。 You can set custom headers which will be send to the client. 您可以设置将发送到客户端的自定义标头。 In this case, you can set an Expires header for your files. 在这种情况下,您可以为文件设置Expires标头。
Cloudfront works a little bit differently as it depends on your origin. Cloudfront的工作方式略有不同,因为它取决于您的来源。
I just got lucky with this question. 我对这个问题很幸运。 Actually, when uploading files in Bucket you should see SET DETAILS in the upload window. 实际上,在Bucket中上传文件时,您应该会在上传窗口中看到SET DETAILS 。
Click it and go through it. 单击它并完成它。 You'd end up with an option to SET METADATA for the files. 您最终会为文件选择SET METADATA 。
There are other ways too. 还有其他方法。 This might help you. 这可能对你有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.