perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject Re: get the incoming TCP protocol type
Date Mon, 26 Nov 2012 08:05:13 GMT
Vincent Veyron wrote:
> Le samedi 24 novembre 2012 à 16:58 +0100, André Warnier a écrit :
> 
>> Is there somewhere a "is_secure()" or something which provides that ?
>> Or can I rely on the presence/absence of some request header ?
>>
> 
> 
> Apache's mod_rewrite has the HTTPS RewriteCond directive, which I use to
> enforce https access on a site like so:
> 
>  RewriteCond %{HTTPS} off
> 
>  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
> 
> May be you can use this to mark the request somehow?
> 

My problem is slightly different : I don't need to "enforce" HTTPS on the requests which I

proxy; I need to determine if the incoming request was made via HTTPS.

But your tip above actually pointed to something which may be of use to me : in

http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritecond

there is apparently a "server variable" HTTPS which can be tested in a RewriteCond, and 
which looks just like what I need :

HTTPS
     Will contain the text "on" if the connection is using SSL/TLS, or "off" otherwise. 
(This variable can be safely used regardless of whether or not mod_ssl is loaded).

Now I just have to find out how I can actually access such a "server variable" inside a 
mod_perl handler.  But that should be a breeze, considering the nice online mod_perl 
documentation, right ?
Let's see if I can beat Torsten to it..




Mime
View raw message