PHP: Worry about some magical added “Cache-Control” Header ?
session_cache_limiter directive
Maybe your wondering about some HTTP Headers sent to your browser which are not set in your script by the header()
function ? Especially these Cache-Control headers:
Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache
First of all: everything is ok! These headers are automatically set by the PHP Session module to prevent browser/proxy based caching of your pages. Depending on your environment setup, it’s possible to control these headers by using the session_cache_limiter() function or use the php.ini
To disable these behaviour just pass an empty string to the session_cache_limiter() function as mentioned in the documentation:
Solution#
// add this line to the beginning of your php script to disable the cache limiter funktion: session_cache_limiter('');