Header is a mod_headers directive that allows you to change HTTP header fields. In this case, the Header set effectively sets the specified Cache-Control and Expire header fields, so the existing header field will be overwritten.
The first directive sets the Cache-Control header field with the value max-age=290304000 , which describes the freshness lifetime of 290304000 seconds relative to the response time.
In contrast, the second directive sets the Expires header field with a value of Thu, 15 Apr 2020 20:00:00 GMT , which describes the freshness lifetime with an absolute time value.
Both Cache-Controls maximum value and expiration date can be converted to another :
4.2.1. Life expectancy calculation
The cache can calculate the freshness lifetime (denoted as freshness_lifetime) of the response using the first match as follows:
...
If the maximum age directive is specified ( Section 5.2.2.8 ), use its value or
If the Expires response header field ( Section 5.3 ) is present, use its value minus the value of the Date response header field, or
...
But if both are present, the maximum age of Cache-Controls is greater compared to Expires :
If the response includes a Cache-Control field with the maximum directive age ( Section 5.2.2.8 ), the receiver MUST ignore the Expires field. Similarly, if the response includes the s-maxage directive ( Section 5.2.2.9 ), the general cache receiver MUST ignore the Expires field. In both cases, the value in Expires is intended only for recipients who have not yet implemented the Cache-Control field.
Instead of manually configuring these HTTP caching header fields, the mod_expires ExpiresDefault directive makes it easy to configure HTTP caching. The freshness lifetime can either be described with an absolute value, or with a relative value, or relative to the response time (i.e. access / now ), or relative to the modification time of the requested file (i.e. modification ). It uses both Cache-Control and Expires.
In this case, the third directive sets the default lifetime to be 10 years from the moment of response.
I would use mod_expires to control the HTTP cache instead of doing it manually with Header . This is much more convenient, allows both relative and absolute freshness times and uses both Cache-Control and Expires.
Gumbo Sep 19 '10 at 15:39 2010-09-19 15:39
source share