views:

231

answers:

3

Yesterday I've tried to get serious about rightly caching some PHP generated pages (think "Articles with comments"). Big fail.

Long story short: I set the ETag header, set the Last-Modified one and check server side every Article browser request with them to see if I can send back a 304.

The problem is simple: the browser (tried with FF 3, so far), after 1 or 2 reloads, suddendly stops checking back the freshness of the page and uses its cached copy.

For what I have understood, using ETag and Last-Modified, the browser MUST check with the server on every request (otherwise, why we should use ETag at all?).

I tried also playing with Cache-Control or Expires... nothing. One way or another, the browser stops checking, or does not send back the ETag...

I'm really frustrated... does anyone happen to have this thing sorted out?

+3  A: 

You should always set "Expires" if you want browser re-validate.

Firefox3 do checking is based on "Expires" header. If it is missing, firefox3 will makeup an expires date for performance.

Reference, Difference betwwen firefox and ie cacheing

Dennis Cheung
A: 

Very interesting readinf. Tomorrow I'll check it out (I did some test with Exprires too... but now I'm more "enlightned") ;)

Claudio Cicali
A: 

You can inspect the current FF cache entries at

about:cache

This will show you the expirey dates the FF stored with each cache entry.

mkoeller