IE 忽略更新的缓存控制标头
我有一个网站,目前允许缓存其图像,但是,决定不再允许缓存。因此,我继续将缓存控制和过期标头添加到响应标头中。
然而,我注意到 IE 仍然对图像发出条件请求,并且服务器以 304 响应进行响应。在 304 响应中,我看到更新的缓存控制和 Expires 标头,但 IE 继续使用缓存中的图像。无论我刷新或打开和关闭浏览器多少次,它仍然使用缓存的图像。只有在我清除缓存文件夹后,IE才会最终监听缓存控制标头。
我想知道是否有人可以为我解释 IE 中的这种行为。这是 IE 的问题还是我不了解缓存控制。谢谢,
注意:当我提到网站允许缓存图像时,这是通过根本不提供任何缓存控制或过期标头来完成的。仅使用了 ETag 标头。
I have a website which currently allows caching of its images, however, there was a decision to no longer allow caching. So I proceded to add cache-control and Expires headers to the response header.
I noticed however that IE still sends out a conditional request on the images and the server responds with a 304 response. In the 304 response, I see the updated cache-control and Expires headers, but IE continues to use the images from the cache. No matter how many times I refresh or open and close the browser it still uses the cached images. Only after I clear the cache folder will IE finally listen to the cache control headers.
I was wondering if someone could explain this behaviour in IE for me. Is this an IE qurk or I not understanding something about cache control. Thanks,
Note: When I mentioned that the website allowed caching of images, this was done by not providing any Cache-control or Expire headers at all. Only a ETag header was used.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要为图像设置 max-age 标题。您可以在 IIS 级别或 web.config 中设置它。
有一篇关于它的好文章:
http: //www.stardeveloper.com/articles/expires-and-max-age-headers-in-aspnet/
You will need to set the max-age headers for your images. You can set it at the IIS level or in the web.config.
There is a good article on it at:
http://www.stardeveloper.com/articles/expires-and-max-age-headers-in-aspnet/