Chrome缓存过长 [英] Chrome Caches for Too Long
问题描述
在我的网站www.johnshammas.com上,它适用于所有浏览器。除了...在Chrome浏览器上查看过以前版本的任何人都会停留在该版本上,直到他们清空缓存为止。什么会导致网站返回一个未修改的头,实际上它已经被大量修改了?
解决方案 code> 304 Not Modified 响应被返回,这是因为之前服务器使用 ETag
或 Last-Modified
头。
稍后,浏览器将此值作为 ETag
或 If-Modified-Since
标头。服务器识别ETag或日期,以便资源在浏览器最后一次请求时没有改变。
所以它返回一个 304
。
如果您对这些或其他缓存标头不熟悉,我建议对它们进行一些研究。关于这些内容以及如何使用它们,有很多很棒的教程。
On my website, www.johnshammas.com, it works perfectly in all browsers. Except...anyone that has viewed the previous version on Chrome is stuck with that version until they empty their cache. What would cause the website to return a "not modified" header when in reality it has been modified heavily?
If a 304 Not Modified
response was returned, it was because earlier the server sent a response with an ETag
or a Last-Modified
header.
Later, the browser sent this value as an ETag
or If-Modified-Since
header. The server recognized the ETag or date such that the resource had not changed since the browser last requested it.
So it returned a 304
.
If you are not familiar with these or other cache headers, I recommend doing some research on them. There are many great tutorials on what these are and how to use them.
这篇关于Chrome缓存过长的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!