Ticket #21374 (closed: wontfix)
project web Cache-Control
|Reported by:||dmex||Owned by:||burley|
|Keywords:||SOG P2 PRWEB||Cc:|
I've been trying to set the following header for one of our php files to be cached locally for 12/24 hours for our desktop updater, however the SF web servers over-ride my values.
Per RFC 2616, max-age takes precedence over Expire. If you have two max-age values then the second takes precedence over the first.
Regardless of the Cache-Control directives I use, sfweb always appends 'Cache-Control:max-age=172800' and that over-rides all Cache-Control directives I use, for example:
//calc an offset of 24 hours
$offset = 3600 * 24;
//calc the string in GMT not localtime and add the offset
$expire = "Cache-Control: Expires: " . gmdate("D, d M Y H:i:s", time() + offset) . " GMT";
//output the HTTP header
Result: 'Cache-Control: Expires: Thu, 25 Aug 2011 20:06:48 GMT, max-age=172800'
My max-age value is being ignored since the sfweb value is appended instead of my value and per the RFC it takes precedence over all other caching directives (e.g. all other caching directives are ignored)
Removing the Expires code:
Result: 'Cache-Control:max-age=28800, max-age=172800'
Again sfweb appended it's value and per the RFC the second value takes precedence over all other caching directives resulting in my value of 28800 being ignored.