Camen Design Forum

Cache Headers

append delete JJ

I've been starting to port NNF to node recently and I noticed the cache headers are:

% HTTP 1.1
Cache-Control: no-cache, max-age=0

Ideally, they should be:

% HTTP 1.0
Pragma: no-cache
Expires: 0


Cache-Control: no-cache
Expires: 0

Reply RSS


append delete #1. JJ

Ignore that second "Expires: 0" at the end - copy and paste mistake**

JJ added on

Actually, wait a second, ignore my previous post, it seems the code blocks are getting all mixed up. This is confusing.

JJ added on

In order, I meant for the code blocks to be: HTTP, HTTP 1.0, HTTP 1.1 in that post

append delete #2. Kroc

The code blocks could be restoring in reverse, that would be a bug.

Kroc added on


append delete #3. Kroc

To be honest, I don’t know what the headers should be. There's too much conflicting information out there. Headers are output by each PHP page, but there's also the headers set in the htaccess. If these could be more unified that would be good.

append delete #4. JJ

Yeah, setting everything in the scripts would be good.

For real good measure you could just do:

Cache-Control: no-cache, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0

Cache-Control was added in http 1.1, before that there was only the very poorly thought out "pragma" and "expires" headers. You could just use Cache-Control, but it wont work for agents that only support http 1.0. Although, if all http/1.1 agents pay attention to pragma and expires, you could drop the cache-control header altogether and just use pragma, and expires, I'm not sure.


(Leave this as-is, it’s a trap!)

There is no need to “register”, just enter the same name + password of your choice every time.

Pro tip: Use markup to add links, quotes and more.

Your friendly neighbourhood moderators: Kroc, Impressed, Martijn