max-age, no-Cache,must-revalidate on Cache-Control Header,这里优先考虑哪个?
Posted
技术标签:
【中文标题】max-age, no-Cache,must-revalidate on Cache-Control Header,这里优先考虑哪个?【英文标题】:max-age, no-Cache,must-revalidate on Cache-Control Header, Which takes predence here? 【发布时间】:2015-02-14 09:59:57 【问题描述】:Cache-Control : max-age=86400, no-store, must-revalidate, no-cache
这是服务器为 JS 文件设置的响应头。
这是否意味着响应在重新验证之前缓存了 86400 秒?
以上哪一项优先,结果是什么?
【问题讨论】:
【参考方案1】:看起来 no-cache 优先于所有。
HTTP1.1 规范说“If the no-cache directive does not specify a field-name, then a cache MUST NOT use the response to satisfy a subsequent request without successful revalidation with the origin server.
”
参考http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.1
它还显示“The max-age directive on a response implies that the response is cacheable (i.e., "public") unless some other, more restrictive cache directive is also present.
”
参考http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.3
以上都是针对 HTTP/1.1 的。
【讨论】:
以上是关于max-age, no-Cache,must-revalidate on Cache-Control Header,这里优先考虑哪个?的主要内容,如果未能解决你的问题,请参考以下文章
web性能优化之:no-cache与must-revalidate深入探究
web 性能优化之:no-cache 与 must-revalidate 深入探究