本文介绍了HTTP中缓存控制标头的最大值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Amazon S3为我的网站提供静态资源。我想让浏览器尽可能长时间地缓存这些资产。我应该在资产中包含哪些元数据标题
I'm using Amazon S3 to serve static assets for my website. I want to have browsers cache these assets for as long as possible. What meta-data headers should I include with my assets
Cache-Control: max-age=???
推荐答案
通常建议将一年作为标准最大值。请参阅:
Generally one year is advised as a standard max value. See RFC 2616:
虽然这适用于较旧的到期
标准,在没有任何明确的标准指导的情况下,适用于缓存控制
也是有意义的。只要你通常需要它,并且选择任意更长的值可能会打破一些用户代理。所以:
Although that applies to the older expires
standard, it makes sense to apply to cache-control
too in the absence of any explicit standards guidance. It's as long as you should generally need anyway and picking any arbitrarily longer value could break some user-agents. So:
Cache-Control: max-age=31536000
这篇关于HTTP中缓存控制标头的最大值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!