views:

62

answers:

2

I have a website in which I update the content approximately once monthly. When I check the HTTP request header fields, I get the following output:

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

My question is, given the frequency at which I update content, I am thinking about manually setting these fields to allow cache of the site. I am using the php header(); command to do so.

Therefore, my question is: what should my expires, cache-control, and pragma HTTP request header fields be set to? Also, should I be setting any other fields in addition to those?

A: 

You could look into using ETAGs - http://en.wikipedia.org/wiki/HTTP_ETag

hafichuk
A: 

Your Expires header should be the date in the future at which time the content will expire and caches will be forced to fetch it again.

Get rid of the Pragma header

For Cache-Control you can add: public max-age=2592000

Assuming you want it cached for 30 seconds.

For greater control you should follow hafichuk's advice and use ETags.

For references on cache headers check out Headers

methodin