Current time: 05-30-2020, 06:57 PM Hello There, Guest! (LoginRegister)

Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Etag/Last Modified - the numpty question I've always wanted to know.
11-02-2010, 07:26 AM
Post: #5
RE: Etag/Last Modified - the numpty question I've always wanted to know.
(11-02-2010 02:13 AM)aaronpeters Wrote:  
(11-02-2010 01:43 AM)pmeenan Wrote:  Do you have a reference for the Google recommendation? All I could find was the Page Speed optimization docs: http://code.google.com/speed/page-speed/...serCaching and they don't seem to say anything specific about having both strong and weak headers.

Pat, this sentence is on that page:
"It is important to specify one of Expires or Cache-Control max-age, and one of Last-Modified or ETag, for all cacheable resources."

So yeah, send 1 strong one (Expires or CC) *and* one weak one (Last-Modified/ETag).
Imo, this is a good best practice.

The weak one will only kick in if the Expires has .... expired. The browser will then have a file in cache but is not sure if it may use it. So it sends a conditional request to the server, asking the server "hey dude, may I use this file or not?" and the server will respond with either a 304 "yeah man, go ahead" or a 200 "nope, here is a new one, use that and throw away the old".

Thanks for going easy chaps. The thing that I think I don't like is that I can't work out whether the 304 "carry on" response itself persists. Is it just a "yeah man, carry on this time", or a "yeah man, carry on and BTW there's no need to bug my ass again for another n seconds"?

I suppose what I should really do is get off my backside and wireshark this stuff across browsers with various combinations of header :-D. (What I see in Firebug really confuses me - as jabubo finds as well, I think. I see conditional Gets *before* CC expiry, but only on every second request. Maybe that's what Google mean with the statments "the browser applies a heuristic to determine whether to fetch the item from cache or not. (The heuristics are different among different browsers.)").

BTW Pat, you recommend against Etags: 'ETag headers should generally not be used unless you have an explicit reason to need them'. Can you elucidate?

Thanks again everyone.

Neil
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Etag/Last Modified - the numpty question I've always wanted to know. - p83822 - 11-02-2010 07:26 AM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)