中国服务器网

服务器问题集锦,包括 Linux(Ubuntu, Centos,Debian等)和Windows Server服务器

Chrome会忽略ETag标头,只是使用内存caching/磁盘caching

如果我理解正确,那么使用ETags的stream程如下所述: 浏览器将请求发送到服务器。 服务器用ETag发回图像 浏览器随同ETag一起保存资源 在下一个请求中,浏览器发送带有包含保存的ETag的头部If-None-Match的请求。 当返回响应时,chrome开发工具告诉我这些是我的头文件 Cache-Control:max-age=7200 Connection:keep-alive Content-Type:image/png Date:Thu, 27 Apr 2017 13:42:57 GMT ETag:"b36f59c868d4678033d318a182658e18371df8f5" Expires:Thu, 27 Apr 2017 15:42:57 GMT Server:nginx Transfer-Encoding:chunked X-Debug-Token:873c8f X-Debug-Token-Link:http://localhost:8081/_profiler/873c8f 现在,当我重新加载页面时,不会收集新的图像。 它通过Chrome的内存caching或磁盘caching保存,如您在这里看到的 但为什么会这样呢? 我发送了一个ETag,为什么浏览器不向服务器发出另一个请求,而是使用它自己的caching? 我问的原因是,我们想要caching我们的图像,但只要他们改变,他们应该立即更新。 为什么Chrome会这样做? 更新 我只是注意到它在Firefox上的作用,所以这似乎是一个铬“function”,而不是一个configuration。 更新2 设置我的新标题像这样的图像 Cache-Control:max-age=0, private Connection:keep-alive Content-Type:image/png Date:Thu, 27 Apr 2017 14:44:57 GMT ETag:"e5b18bdebe44ed4bba3acb6584d9e6a81692ee27" Expires:Fri, 27 Oct 2017 14:44:57 GMT Server:nginx Transfer-Encoding:chunked […]

群控