perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John ORourke <>
Subject Re: How to extract the protocol part of URL from an apache request
Date Wed, 17 Sep 2008 08:32:17 GMT
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.


View raw message