[英]IE 11 ignoring Cache Control header in response
I am setting Expires filter in web.xml of Tomcat. 我在Tomcat的web.xml中设置Expires过滤器。 The header comes correctly in response but still IE is not caching. 标头响应正确,但IE仍然没有缓存。 It is always making the fresh request to Tomcat. 它始终向Tomcat提出新的请求。
<filter>
<filter-name>ExpiresFilter</filter-name>
<filter-class>org.apache.catalina.filters.ExpiresFilter</filter-class>
<init-param>
<param-name>ExpiresByType image/png</param-name>
<param-value>access plus 2 hours</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>ExpiresFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
Below are the headers from respone 以下是来自respone的标题
Cache-Control: max-age=7199 缓存控制:max-age = 7199
Expires: Mon, 14 Nov 2016 16:08:22 GMT 到期日:2016年11月14日星期一16:08:22 GMT
Content-Type: image/png 内容类型:image / png
Transfer-Encoding: chunked 转移编码:分块
Date: Mon, 14 Nov 2016 14:08:22 GMT 日期:星期一,2016年11月14日14:08:22 GMT
Does anyone know, what am I missing here? 有谁知道,我在这里错过了什么?
There is Microsoft's own documentation on cache-control . 有关于缓存控制的Microsoft自己的文档 。
Short answer: you have to use Pragma: no-cache
, Cache-Control: no-cache
and Expires
all together. 简短的回答:你必须使用Pragma: no-cache
, Cache-Control: no-cache
和Expires
all。
Update 2019-01-24 更新2019-01-24
The above instructions are for disabling caching, while the answer to being able to force caching can be found in this fine SO answer: Make IE to cache resources but always revalidate 上面的说明用于禁用缓存,而能够强制缓存的答案可以在这个很好的答案中找到: 让IE缓存资源但总是重新验证
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.