httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Neil A. Hillard" <>
Subject [users@httpd] RewriteRule and Environment variables...
Date Mon, 23 Jan 2006 12:37:38 GMT

Robert Ionescu wrote:
> Neil A. Hillard wrote:
>> Hi,
>>     I've been bashing my head against the wall with this problem for a 
>> while now and apart from a headache haven't really got anywhere.
>>     I currently have Apache (2.0.54 but I've tried 2.0.55), built from 
>> source, running as an accelerator to several backends.  Without 
>> getting too deep into how I'll be using it, I'm essentially trying to do:
>> SetEnv PROTO http
> Try to use the module mod_setenvif instead of mod_env. As said in the 
> manual (mod_env):
> |Summary
> |
> |This module allows for control of the environment that will be provided 
> |to CGI scripts and SSI pages.

I couldn't spot an easy way of using SetEnvIf to determine whether the 
request had come in using http or https, so I've used mod_rewrite to do it:

RewriteRule     .* - [E=PROTO:http]
RewriteCond     %{HTTPS} on
RewriteRule     .* - [E=PROTO:https]

I can then use %{ENV:PROTO} in any subsequent RewriteRules.

This appears to be working as desired.


Neil Hillard          
Westland Helicopters Ltd.

Disclaimer: This message does not necessarily reflect the
             views of Westland Helicopters Ltd.

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