Cache-Control HTTP header question


Hi all,
When back-button is used, my site displays the dreaded ‘Webpage is Expired’ screen (and when the page is reloaded all form values are lost). I’m trying to avoid this.

I’ve tried adding the ‘Cache-control: public’ HTTP header, and this seemed to work well on my localhost wamp server.

header( ‘Cache-control: public’);
header(“expires: -1”);[/font]

However on my dreamhost server, it does not work. I used ieHTTPHeaders to display the HTTP headers, and found that there are two Cache-control HTTP headers, the one I added (‘Cache-control: public’), as well as a default one (‘Cache-control: max-age=0, no-cache, no-store’).

[font=Courier]HTTP/1.1 200 OK
Date: Fri, 13 May 2011 03:25:26 GMT
Server: Apache
Cache-control: public
expires: -1
Set-Cookie: PHPSESSID=CyOQvQdu8GKp%2C93loU7yX1; path=/
Cache-Control: max-age=0, no-cache, no-store
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 1762
Keep-Alive: timeout=2, max=100
Connection: Keep-Alive
Content-Type: text/html[/font]

Does any one know where this extra ‘Cache-control: max-age=0, no-cache, no-store’ HTTP header is coming from and how to remove it?


Where is “expires: -1” coming from? Aside from being invalid (the value of Expires must be a valid HTTP date), that will likely inhibit the browser from reusing a cached page, regardless of any other settings.

I’m not sure what would be generating the extra Cache-Control header, but mod_pagespeed is a likely culprit. Try turning that off.


Many thanks, that worked.
(I unchecked the Dreamhost ‘Page Speed Optimization’ in the domain hosting option page).