Detecting if https is used from within a .conf file

Toomas Aas <[email protected]>
Newsgroups gmane.comp.apache.mod-ssl.user
Message-ID <[email protected]>
Hello!

I set out to accomplish what I thought was a simple task 3 hours ago, 
but now I'm stumped. Is there a way to have a conditional block in 
httpd.conf which would achieve a simple thing like this:

if current connection is a https connection
	some directives
end

?

The obvious answer is, of course, put these directives in your ssl 
virtualhost, so let me explain further...

I have a site which is available both via http and https. There are two 
virtual hosts defined for this site, one with
<VirtualHost IPAddress:80>

And one with
<VirtualHost IPAddress:443>

Additionally, there are a number of name-based virtual host served on 
the same IPAddress on port 80.

The two aforementioned VirtualHost sections in my config file contain
a fair amount of Alias and Redirect directives which are almost, but not
entirely, identical. For example, there are several of Redirect 
directives that redirect to http://www.mysite.com/somewhere for the http 
vhost and to https://www.mysite.com/somewhere for the https vhost.

I was thinking of putting this large block of directives into separate 
file and Include it in both vhost sections, to tidy up my main config 
file. But in order to do that, I would need to define some logic in this 
file for those cases where http and https need to be handled separately. 
I was certain that such possibility exists, but I'm starting to have 
some doubts now. Any advice?

Using Apache 2.0.53.

--
Toomas Aas
______________________________________________________________________
Apache Interface to OpenSSL (mod_ssl)                   www.modssl.org
User Support Mailing List                      [email protected]
Automated List Manager                            [email protected]
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.