问题
I want to set a far future Expires headers to reduce requests made from individual browsers.
I'd also like to set Cache-Control: s-maxage=600 so that proxy caches (and CDNs) revalidate with the origin every 10 minutes for fresh content.
Will browsers honour the Expires header despite the existence of a Cache-Control header (which supposedly supersedes it) with a s-maxage directive?
回答1:
If a response includes both an Expires and a Cache-Control max-age directive, the max-age 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 cache than to an HTTP/1.0 cache.
Source: http://condor.depaul.edu/dmumaugh/readings/handouts/SE435/HTTP/node24.html
回答2:
If both are included then both will be checked, neither has precedence. Max-age does not supersede expires, it's additional.
来源:https://stackoverflow.com/questions/12479581/does-cache-control-s-maxage-header-override-expires-header-for-browser-cache