title: What is the function of the "Vary: Accept" HTTP header?
body: <p>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.</p>
  
  <p>Link:
  <a href="http://keystonewebsites.com/articles/mime_type.php" rel="noreferrer">http://keystonewebsites.com/articles/mime_type.php</a></p>
  
  <p>Now I'm not sure of the implication of:
  header('Vary: Accept');
  I'm not really sure of what 'Vary: Accept' will precisely do...</p>
  
  <p>The only explanation I found is:</p>
  
  <blockquote>
    <p>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.
    <a href="http://www.456bereastreet.com/archive/200408/content_negotiation/" rel="noreferrer">http://www.456bereastreet.com/archive/200408/content_negotiation/</a></p>
  </blockquote>
  
  <p>Anyone can give me a "real" explanation of this header (<strong>with that value</strong>). I think I understand things like:
  Vary: Accept-Encoding
  where the cache on proxies could be based on the encoding of the page served, but I don't understand:
  Vary: Accept</p>