为什么我在“每次访问页面”时都会收到304?

时间:2013-10-14 07:30:36

标签: internet-explorer http-headers browser-cache fiddler http-status-code-304

我们有一个具有此设置的(旧)Intranet站点

Every time I visit the page:true

enter image description here

但我仍然可以在开发人员工具中看到很多304个回复:

enter image description here

问题

  • 为什么?如何强制查看所有回复200

相关信息:

IIS 7.5

它发生在IE9-10(该网站仅在IE上运行)(浏览器模式更改为ie9,因为它是一个旧网站(内部网),没有调整到新浏览器。

使用fiddler - 它也显示304。

enter image description here

enter image description here

enter image description here

请求标头示例:

enter image description here

2 个答案:

答案 0 :(得分:3)

  

每次访问网页时都会检查存储页面的较新版本

简单地表示IE将('check',因此)在请求中包含与缓存相关的标头(If-Modified-SinceETag等)。然后,只有当服务器感觉缓存“未命中”时,服务器才会返回200

另请注意,只有当服务器无法使用Cache-ControlExpires响应标头指定缓存新鲜度生命周期时,才会应用有问题的设置。请参阅this article有条件请求部分以了解详情。

如果要将服务器配置为禁用整个目录的客户端缓存,请尝试以下操作:

<configuration>
  <location path="your_assets_dir">
    <system.webServer>
      <staticContent>
        <clientCache cacheControlMode="DisableCache" />
      </staticContent>
    </system.webServer>
  </location>
</configuration>

答案 1 :(得分:2)

http 304代码是SERVER代码,所以你的浏览器和它的&#39;设置并不真正相互关联,304代码意味着浏览器发送if-modified-since,服务器检查了这个日期并返回&#34;未修改&#34;

相关问题