max-agedirective of the
Cache-ControlHTTP header in server responses.
These HTTP headers are an instruction to the client about the document's validity and persistence. If cached, the document may be fetched from the cache rather than from the source until this time has passed. After that, the cache copy is considered "expired" and invalid, and a new copy must be obtained from the source.
By default the mod_expires is turned off but you can turn it on and configure it by adding following instructions to your httpd.conf
ExpiresDefault "access 1 week"
ExpiresActionOn will turn the mod_expires on but it does not do anything by itself, and you will have to set
ExpiresDefaultdirective to let Apache no what should be the
cache-controlsetting for every resource. In my case i am saying that every document would be fresh for 1 week after user's first access.
I tried accessing a static resource on Apache after configuration and this is what i see
The value of
max-ageis set to
604800seconds which means 7 days. Also the
Expiresheader is set by taking the value of Date header and adding 7 days to it.
Expiresheader because the html response might go through a proxy or other device that does not understand HTTP 1.0 and in that case that device will read value of