Drew2345
Drew2345

Reputation: 111

What should my Pragma HTTP response header be set to?

I have my cache related headers set to expire at eight hours as follows...

header('Cache-Control: max-age=28800');
header('Expires:' . gmdate('D, d M Y H:i:s T', strtotime('+8 hours')));

With that being the case, what should my Pragma HTTP response header be set to?

Upvotes: 0

Views: 8053

Answers (2)

AlexV
AlexV

Reputation: 23108

See the PHP doc for session_cache_limiter. You will see the correct cache headers to send:

public:

Expires: (sometime in the future, according session.cache_expire)
Cache-Control: public, max-age=(sometime in the future, according to session.cache_expire)
Last-Modified: (the timestamp of when the session was last saved)

private_no_expire:

Cache-Control: private, max-age=(session.cache_expire in the future), pre-check=(session.cache_expire in the future)
Last-Modified: (the timestamp of when the session was last saved)

private:

Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: private, max-age=(session.cache_expire in the future), pre-check=(session.cache_expire in the future)
Last-Modified: (the timestamp of when the session was last saved)

nocache:

Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache

Upvotes: 1

hellvinz
hellvinz

Reputation: 3500

You don't have to set pragma, pragma is set only if you want a no-cache directive. Have a look here for more information: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.32

Upvotes: 3

Related Questions