0

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.

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the explanation, I will just continue using both.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.