IE 9+ ignores ETag value change and returns cached response

有些话、适合烂在心里 提交于 2019-12-03 12:36:59

Internet Explorer uses some heuristics for caching responses. You can read more at Caching Improvements in Internet Explorer 9 in the Heuristic Cache Improvements section:

If a Last-Modified header wasn’t present in the server’s response, then Internet Explorer will fall back to the “Once per browser session” revalidation behavior.

and:

if the response does have a Last-Modified time, the heuristic expiration value SHOULD be no more than some fraction of the interval since that time. A typical setting of this fraction might be 10%.

What you want is to bypass these heuristics and force IE to revalidate the content with the server. To do so, please check Make IE to cache resources but always revalidate and its answer. The key headers seem to be:

Last-Modified: Wed, 16 Feb 2011 13:52:26 GMT
Expires: -1
Cache-Control: must-revalidate, private

Bonus: please also see the section about the Vary Improvements in the earlier link:

If a response contains a Vary directive that specifies a header other than Accept-Encoding, Host, or User-Agent (or any combination of these) then Internet Explorer will still cache the response if the response contains an ETAG header. However, that response will be treated as stale and a conditional HTTP request will be made before reuse to determine if the cached copy is valid.

While it does not say what happens when no Vary header specified, it might be worth playing with this value (see this post)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!