Clint Gilders wrote:
> Ok... I looked through the archives and found some info on setting up
> ssl and non ssl virtual domains:
> 

Greetings, Clint,

It was me who posted that configuration - I'm glad you found it useful!
The behaviour you describe is quite normal. Perhaps I should have
anticipated that and made a note to that effect in the posting. 

As John Helmuth has already explained, apache sees a TCP/IP packet with
"Port 443" written on the address label and so gives it to the only
VirtualHost it has which is listening to that port.

The thing to be aware of is that SSL transactions have to be complete
before HTTP can be used. This means that HTTP-level variables, such as
ServerName, are not available when the server is negotiating the SSL
session. This is the reason why you cannot use Name-Based Virtual
Hosting with SSL virtual hosts. The precise FAQ to look at is:

http://www.modssl.org/docs/2.7/ssl_faq.html#ToC46

The configuration I posted was meant to provide a quick and easy set-up
for someone with only one IP address who wanted several HTTP hosts and
exactly one SSL host.

If you want to protect against the behaviour you describe you might try
using mod_rewrite to shunt connections back to the HTTP VirtualHosts. It
is a bit complicated though and involves conditional rewrites. Something
like:

< ...inside the SSL VH...>

  RewriteEngine on
  RewriteCond %{HTTP_HOST} www.perlnerd.com
  RewriteRule .* http://www.perlnerd.com/

What happens here is that the request sneaks into the SSL host, as we
have seen, but then it encounters the RewriteCond directive. It says "if
the HTTP_HOST is www.perlnerd.com, then carry out the following
RewriteRule". The RewriteRule then gets the request and says; "any
request reaching here gets rewritten as http://www.perlnerd.com". That
is, it gets bounced to the normal HTTP host.

Note that you have to have compiled in mod_rewrite for this to work
(./httpd -l will give you a list of the modules you have compiled in
already).

Rgds,

owen Boyle.
______________________________________________________________________
Apache Interface to OpenSSL (mod_ssl)                   www.modssl.org
User Support Mailing List                      [EMAIL PROTECTED]
Automated List Manager                            [EMAIL PROTECTED]

Reply via email to