Re: how to detect if current connection is https?

Louis-David Mitterrand <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
On Thu, Jun 12, 2014 at 11:50:45AM +0200, Torsten Förtsch wrote:
> On 12/06/14 11:41, Louis-David Mitterrand wrote:
> > I found Apache2::ModSSL which adds $c->is_https but it seems old and not
> > packaged for debian.
> 
> I am the author of said module. I haven't tried it with the httpd24
> branch. But for httpd 2.2. it is expected to work.
> 
> However, the only reason you might need it is to get access to SSL
> related stuff prior to the response phase. If you only need that
> information in the response phase, you can have mod_ssl set a bunch of
> environment variables accessible via $r->subprocess_env.
> 
> Also, SSL in HTTPD is bound to a certain endpoint on the server. So, if
> you know that your server listens on IP:PORT for SSL connections, you
> can check that using the modperl API.

On Thu, Jun 12, 2014 at 01:15:36PM +0200, Winfried Neessen wrote:
> Hi,
> 
> mod_ssl in Apache 2.x has the option to set specific environment variables for
> SSL related stuff. This requires "SSLOptions" directive to be set to at least
> "+StdEnvVars". If that is set, you can access it easily by checking for $ENV{'HTTPS'}.
> 
> See https://httpd.apache.org/docs/current/mod/mod_ssl.html for more information.

Thank you both for your suggestions.

I finally settled on: $r->subprocess_env('REQUEST_SCHEME') eq 'https'
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.