note 101275 added to function.header

From: Date: Mon, 06 Dec 2010 19:44:48 +0000
Subject: note 101275 added to function.header
Groups: php.notes 
Request: Send a blank email to php-notes+get-174671@lists.php.net to get a copy of this message
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. ---- Server IP: 69.147.83.197 Probable Submitter: 217.74.219.156 ---- Manual Page -- http://www.php.net/manual/en/function.header.php Edit -- https://master.php.net/note/edit/101275 Del: integrated -- https://master.php.net/note/delete/101275/integrated Del: useless -- https://master.php.net/note/delete/101275/useless Del: bad code -- https://master.php.net/note/delete/101275/bad+code Del: spam -- https://master.php.net/note/delete/101275/spam Del: non-english -- https://master.php.net/note/delete/101275/non-english Del: in docs -- https://master.php.net/note/delete/101275/in+docs Del: other reasons-- https://master.php.net/note/delete/101275 Reject -- https://master.php.net/note/reject/101275 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#174671) next »