IE 忽略更新的缓存控制标头

发布于 2024-09-17 20:24:10 字数 340 浏览 1 评论 0原文

我有一个网站,目前允许缓存其图像,但是,决定不再允许缓存。因此,我继续将缓存控制和过期标头添加到响应标头中。

然而,我注意到 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

江湖彼岸 2024-09-24 20:24:10

您需要为图像设置 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/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文