Expires vs max-age, which one takes priority if both are declared in a HTTP response?

前端 未结 3 1832
无人及你
无人及你 2020-12-24 11:23

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
         


        
3条回答
  •  隐瞒了意图╮
    2020-12-24 11:45

    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.

提交回复
热议问题