HTTP caching, browser weirdness, and everything else!
Yesterday I tried to get serious about properly caching some PHP pages (think "Articles with comments"). Big failure.
Long story short: I set the ETag header, set Last-Modified, and check the server side of every article browser request with them to see if I can post 304 back.
The problem is simple: the browser (tested with FF 3 so far), after 1 or 2 reloads, suddendly stops checking the page freshness and uses its cached copy.
For what I understood using ETag and Last-Modified, the browser MUST check with the server on every request (otherwise, why bother using ETag at all?).
I've also tried playing with Cache-Control or Expires ... nothing. One way or another, the browser stops checking or doesn't send back the ETag ...
I'm really upset ... did anyone accidentally figure this out?
You must always set Expires if you want to re-check your browser.
Firefox3 does check based on the "Expires" header. If it is missing, firefox3 will compose the expiration date.
Link, Difference between firefox and ie cacheing
You can check the current FF cache entries at
about:cache
This will show you the FF expiration dates stored in each cache entry.