Re: How to extract the protocol part of URL from an apache request
On Wed, 17 Sep 2008 00:21:52 -0700 (PDT) grsvarma019 wrote: But , i couldn't find how to extract the protocol(http or https ) from the current URL using apache request object. Can you please anybody help me in this? See: perldoc Apache2::RequestRec # HTTP protocol version number $proto_num = $r-proto_num();
Re: How to extract the protocol part of URL from an apache request
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. Mod_ssl can be configured to export SSL information as environment variables. Those can be looked up in a ResponseHandler via $r-subprocess_env. Further, if you are unable to install an XS module (precompiled mod_perl+apache on windows without C compiler for instance) and you need SSL information prior to the response phase you can issue a subrequest to get it. Not the fastest way but it works. I have described that technique in a previous mail to the list this or last year. Torsten -- Need professional mod_perl support? Just hire me: [EMAIL PROTECTED]
Re: How to extract the protocol part of URL from an apache request
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
Re: How to extract the protocol part of URL from an apache request
On Wed 17 Sep 2008, John ORourke wrote: 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 RewriteCond %{HTTPS} on RewriteRule ^(.*) $1 [E=SCHEME:https] Yes, I think that should work as well without the reverse proxy. Mod_rewrite talks directly to mod_ssl. Torsten -- Need professional mod_perl support? Just hire me: [EMAIL PROTECTED]