httpd-users mailing list archives

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

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.

-- 
Neil Hillard                    hillardn@whl.co.uk
Westland Helicopters Ltd.       http://www.whl.co.uk/

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:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message