CloudFront 图像缓存控制标头
1- 这是一个有效的缓存控制标头吗:
Cache-Control: max-age=86400, s-maxage=3600
2- 我正在尝试为通过 CloudFront 从 S3 提供服务的对象设置缓存控制标头。图像不会经常改变,但有时会改变。这看起来是一个很好的缓存控制吗? CloudFront 应每 60 分钟重新验证一次,但用户将缓存一整天。 (我不太担心单个用户,更担心继续向新用户提供过时的图像)。
3-我还应该使用其他标头吗? (即代理重新验证)
更改 S3 对象上的这些设置并不容易,因此我试图第一次就正确。谢谢。
1- Is this a valid cache control header:
Cache-Control: max-age=86400, s-maxage=3600
2- I am trying to set cache control headers for objects served from S3 through CloudFront. The images don't often change, but sometimes can. Does this seem like a good cache control for this? CloudFront should re-validate every 60 minutes, but the user will cache for a full day. (I'm less worried about an individual user and more worried about continuing to serve the stale image to new users).
3- Are there other headers I should use? (ie. proxy-revalidate)
Its not horrendously easy to change these settings on S3 objects so I'm trying to get it right the first time. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我刚刚让它与
理论上,从 AWS S3 / Cloudfront 文档来看,只有 1. 有效。在实践中,两者都需要。
基思
I just made it working with both
In theory and from AWS S3 / Cloudfront doc, only 1. will works. In practice, it takes both.
Keith
这就是我要做的工作:
理论上,你只需要其中之一。但是 S3 和 CloudFront 的整个浏览器缓存一直是我的一大痛苦,所以我喜欢将它们都保留在那里。我还将以下内容放入我的
.htaccess
文件中:Here's what I got to work:
In theory, you only need one or the other. But this whole browser caching thing with S3 and CloudFront has been a big pain in my backside, so I like to keep them both in there. And I also put the following in my
.htaccess
file: