What headers do I want to send together with a 304 response?

Posted by Willem on Stack Overflow See other posts from Stack Overflow or by Willem
Published on 2009-03-27T20:16:59Z Indexed on 2010/05/09 21:38 UTC
Read the original article Hit count: 182

When I send a 304 response. How will the browser interpret other headers which I send together with the 304?

E.g.

header("HTTP/1.1 304 Not Modified");
header("Expires: " . gmdate("D, d M Y H:i:s", time() + $offset) . " GMT");

Will this make sure the browser will not send another conditional GET request (nor any request) until $offset time has "run out"?

Also, what about other headers?

Should I send headers like this together with the 304:

header('Content-Type: text/html');

Do I have to send:

header("Last-Modified:" . $modified);
header('Etag: ' . $etag);

To make sure the browser sends a conditional GET request the next time the $offset has "run out" or does it simply save the old Last Modified and Etag values?

Are there other things I should be aware about when sending a 304 response header?

© Stack Overflow or respective owner

Related posts about http-header-fields

Related posts about http-status-code-304