Re: get the incoming TCP protocol type

André Warnier <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
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..
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.