note 101275 deleted from function.header by thiago

From: Date: Mon, 06 Dec 2010 19:45:27 +0000
Subject: note 101275 deleted from function.header by thiago
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-174672@lists.php.net to get a copy of this message
Note Submitter: example is wrong ---- Example #2 is misleading: > header("Cache-Control: no-cache, must-revalidate"); 'no-cache' does _not_ tell a caching server to not cache content. See RFC2616. It merely tells a caching server that the content must be revalidated on each request. Adding 'must-revalidate' to the mix probably does not do what the author thinks either. It accomplishes the same as no-cache. (must-revalidate also tells the caching server that in addition to revalidating, it should also refrain from using the (still cached!) content in case the origin server is unreachable, but this is somewhat more theoretical.) ===================== It is much simpler to just use max-age. Both of the above directives corresponds to: header("Cache-Control: max-age=0"); // Force caches to refresh this object on each request As opposed to a max-age command that allows stale responses: header("Cache-Control: max-age=60"); // Allow caches to serve stale versions of this object for 60 seconds Or a more advanced version that discerns between browser caches and proxies: header("Cache-Control: max-age=60, s-max-age=0"); // Allow per-user caches such as a web browser to use stale versions of this object for 60 seconds, but force shared caches such as a proxy server to refresh this object on each request.

« previous php.notes (#174672) next »