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?
相关问题
- Browsers render final comma of right-to-left (rtl)
- Chrome dev tools exact computed value for CSS rule
- Change Chromium icon and “chrome” text to custom i
- debugging webgl in chrome
- Shadow DOM CSS Styling from outside is not working
相关文章
- Is there a google API to read cached content? [clo
- Is there a way to hide the new HTML5 spinbox contr
- Google Chrome Cache
- how to download a file on Chrome without auto rena
- Do all browsers on iOS use WKWebview or UIWebVIew?
- Why does Google Chrome NOT use cached pages when I
- Calling Chrome web browser from the webbrowser.get
- AWS API Gateway caching ignores query parameters
The problem is that Chrome needs to have
must-revalidate
in the Cache-Control` header in order to re-check files to see if they need to be re-fetched.Recommend the following response header:
This tells Chrome to check with the server, and see if there is a newer file. IF there is a newer file, it will receive it in the response. If not, it will receive a 304 response, and the assurance that the one in the cache is up to date.
If you do NOT set this header, then in the absence of any other setting that invalidates the file, Chrome will never check with the server to see if there is a newer version.
Here is a blog post that discusses the issue further.
A few possible solutions go like this...
If a
304 Not Modified
response was returned, it was because earlier the server sent a response with anETag
or aLast-Modified
header.Later, the browser sent this value as an
ETag
orIf-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.