Trying to understand the “Vary” HTTP header

newleduat

New Member
I use PHP to generate dynamic Web pages. As stated on the following tutorial (see link below), the MIME type of XHTML documents should be "application/xhtml+xml" when $_SERVER['HTTP_ACCEPT'] allows it. Since you can serve the same page with 2 different MIMEs ("application/xhtml+xml" and "text/html") you should set the "Vary" HTTP header to "Accept". This will help the cache on proxies.Link:http://keystonewebsites.com/articles/mime_type.phpNow I'm not sure of the implication of:header('Vary: Accept');I'm not really sure of what 'Vary: Accept' will precisely do...The only explaination I found is:\[quote\] After the Content-Type header, a Vary header is sent to (if I understand it correctly) tell intermediate caches, like proxy servers, that the content type of the document varies depending on the capabilities of the client which requests the document. http://www.456bereastreet.com/archive/200408/content_negotiation/\[/quote\]Anyone can give me a "real" explanation of this header (with that value). I think I understand things like:Vary: Accept-Encodingwhere the cache on proxies could be based on the encoding of the page served, but I don't understand:Vary: AcceptAny HTTP guru can help?Thanks!
 
Top