A book about performance reads that you should use Expires
or Cache-Control: max-age
but not both .
Expires
was easy to configure on my Apache.
Now I would like to disable the unneeded Cache-Control: max-age
but I don't how to.
Your mention of both headers suggests that you're using mod_expires
.
You cannot select only one header using mod_expires
. The code that sets the headers in mod_expires.c
unconditionally sets both headers to equivalent values:
apr_table_mergen(t, "Cache-Control",
apr_psprintf(r->pool, "max-age=%" APR_TIME_T_FMT,
apr_time_sec(expires - r->request_time)));
timestr = apr_palloc(r->pool, APR_RFC822_DATE_LEN);
apr_rfc822_date(timestr, expires);
apr_table_setn(t, "Expires", timestr);
However, using mod_header
may allow you to set what you want, using something like:
Header unset Cache-Control
There is a case for using both: Cache-Control
allows much finer control than Expires
, while Expires
may help much older clients.