
john-modperl at o-rourke
Sep 17, 2008, 1:32 AM
Post #4 of 5
(596 views)
Permalink
|
|
Re: How to extract the protocol part of URL from an apache request
[In reply to]
|
|
Torsten Foertsch wrote: > On Wed 17 Sep 2008, grsvarma019 wrote: > >> But , i couldn't find how to extract the protocol(http or https ) >> > > There are Apache2::ModSSL and Apache::SSLLookup on CPAN in case you need > that information in a request phase prior to the ResponseHandler. > I had the same problem but the machine serving the request had a reverse proxy in front of it. I used the following to inject a header on the proxy: SetEnv SCHEME http SetEnv HOST localhost RewriteEngine on RewriteCond %{HTTPS} on RewriteRule ^(.*) $1 [E=SCHEME:https] RewriteCond %{HTTP_HOST} ^(.*)$ RewriteRule ^(.*) $1 [PT,E=HOST:%1] RequestHeader set X-Absolute-URI %{SCHEME}e://%{HOST}e That gives you a header containing the protocol and host. hth, John
|