views:

22

answers:

1

I've moved a older site to a new server, and the client has found a very odd behaviour.

Very close to the end, I have this code:

if (!$this->cache) {
    header('Expires: '.gmdate('d M Y H:i:s', 946684800).' GMT');
    header('Cache-Control: no-cache');
    header('Pragma: no-cache');
}

Now the odd thing is the Cache-Control line doesnt work. After packet sniffing I see this:

Expires: 01 Jan 2000 00:00:00 GMT
Cache-Control: max-age=300, public
Pragma: no-cache

The order of the headers is exactly how I set them, but the Cache-Control is completely different. I've grepped my code for any mention of cache-control and there is only that mention, and another one designed to force caching in a different file but it is a different line to what I'm seeing so it cant be the culprit.

Does anyone know why Cache-Control is changing?

A: 

If you are using sessions, it's possible that PHP is overwriting them. Take a look at session_cache_limiter() in the manual.

Alternatively, you can try setting those headers after you call session_start().

(Edit: I missed the bit about "Very close to the end," so maybe this isn't your problem.)

konforce
I'm not using the built in PHP sessions and I've also tried forcing nocache with the sessions as well. Nada.
Nick