Detecting if https is used from within a .conf file
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 And one with 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 modssl-users@modssl.org Automated List Manager[EMAIL PROTECTED]
Re: Detecting if https is used from within a .conf file
Toomas Aas said: > 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. I don't think you can put runtime logic into the configuration but why not just put the common stuff in the included file and the protocol specific stuff in the virtual host sections? -- Michael Pacey __ Apache Interface to OpenSSL (mod_ssl) www.modssl.org User Support Mailing List modssl-users@modssl.org Automated List Manager[EMAIL PROTECTED]
Re: Detecting if https is used from within a .conf file
Toomas Aas wrote: > > 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? Very simple. Just add the logic to apachectl. It's a shell script. __ Apache Interface to OpenSSL (mod_ssl) www.modssl.org User Support Mailing List modssl-users@modssl.org Automated List Manager[EMAIL PROTECTED]