Expires vs max-age,如果两者都在 HTTP 响应中声明,哪一个优先? [英] Expires vs max-age, which one takes priority if both are declared in a HTTP response?
问题描述
如果 HTTP 响应同时返回 Expires 和 max-age 指示使用哪一个?
缓存控制:max-age=3600到期:2008 年 5 月 15 日星期二 07:19:00 GMT
考虑到每一个都指的是不同的时间点.
看到这个答案:
三个.htaccess过期规则之间的区别p><块引用>
如果响应同时包含 Expires 标头和 max-age 指令,max-age 指令会覆盖 Expires 标头,即使Expires 标头更具限制性.此规则允许源服务器为给定的响应提供更长的到期时间HTTP/1.1(或更高版本)缓存而不是 HTTP/1.0 缓存.这可能是如果某些 HTTP/1.0 缓存不正确地计算年龄或过期时间,可能是由于时钟不同步.
If a HTTP response that returns both Expires and max-age indications which one is used?
Cache-Control: max-age=3600
Expires: Tue, 15 May 2008 07:19:00 GMT
Considering that each one refers to a different point in time.
See this answer:
Difference between three .htaccess expire rules
If a response includes both an Expires header and a max-age directive, the max-age directive overrides the Expires header, even if the Expires header is more restrictive. This rule allows an origin server to provide, for a given response, a longer expiration time to an HTTP/1.1 (or later) cache than to an HTTP/1.0 cache. This might be useful if certain HTTP/1.0 caches improperly calculate ages or expiration times, perhaps due to desynchronized clocks.
这篇关于Expires vs max-age,如果两者都在 HTTP 响应中声明,哪一个优先?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!