httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philip Brusten <>
Subject Re: [users@httpd] Apache2.2.2: mod_headers %{env-var}e
Date Fri, 30 Jun 2006 14:07:10 GMT

Joshua Slive wrote:
> On 6/30/06, Philip Brusten <> wrote:
>> Hello,
>> I have a reverse proxy (Apache2.2.2) where I want to set a request
>> header "a" based on the value of another request variable "b".
>> Additionally, request header "b" must have a certain value. If request
>> header "b" doesn't match that certain value, I don't want to set request
>> header "a".
>> This is how I planned to do this:
>> - Check request header "b" and set an environment variable if true.
>> (SetEnvIf)
>> - Set request header "a" with value of request header "b" when the
>> environment variable, mentioned above, is set.
>> eg:
>> SetEnvIf MyRequestVar_b ^regex$ SET_HEADER_OK
>> RequestHeader set MyRequestVar_a %{HTTP_MYREQUESTVAR_B}e 
>> I'm not sure what I'm doing wrong but the second line works under
>> Apache2 but always returns (null) under apache2.2.2. I need apache2.2.2
>> because of its keep-alive functionality as reverse-proxy.
>> Can all request headers be used for matching in the directive SetEnvIf?
>> Maybe I am using a wrong syntax for looking up the environment 
>> variables?
> That's not exactly clear.  Apache 2.2.2 is a subset of Apache2.  What
> is the old version anyway?
The old version is 2.0.54-5
> One quess is that your have "RewriteEngine On" on the old version but
> not the new version.  This has the effect of putting certain variables
> into the environment that would not otherwise be there.
I've tried this, but it has no affect.
Is it possible that the reverse proxy has anything to do with this?

> I don't think RequestHeader has direct access to the HTTP_ variables 
> otherwise, so
> you'd need to use mod_setenvif or mod_rewrite to get at that variable.
I've tested this with the Header directive and without the environment 
variable requirement. It easier to log response headers in my client 
then to do a tcpdump for logging the request headers.

The directive below worked fine for me in Apache 2.0.54-5

Header set MyRequestVar_a %{HTTP_MYREQUESTVAR_B}e


Brusten Philip
LUDIT - K.U.Leuven
W. de Croylaan 52A | 3001 Heverlee | Belgium 


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message