httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Fritsch>
Subject Re: RFE: Control of HTTP cache control headers within mod_rewrite rules
Date Thu, 27 Oct 2011 20:35:01 GMT
On Tuesday 25 October 2011, Noah Robin wrote:
> I ran some tests on this and the following modified version will
> work:
> Header always set Cache-Control max-age=%{CACHE_LIFETIME}e
> RewriteRule /example
> ..however, this still leaves an open question in my mind: How to
> solve for the more general case where I want Apache to set the
> cache control header on any 301 it sends, even if the 301 was
> generated within the application rather than in Apache's
> configuration. I don't see a way to set an environment variable
> based on a response attribute (e.g. r->status). Am I missing
> something or would something need to be written to handle this
> case?

2.3/2.4 supports this:

Header set Cache-Control max-age=604800 "%{REQUEST_STATUS} == 301"

or even "%{REQUEST_STATUS} -in { 301 , 302 }". This is a good 
candidate for an example in the docs.

I can't think of a way to do this in 2.2.x, though.

View raw message