Apache Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationApache Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old September 26th, 2001, 09:16 AM
Ulfven Ulfven is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2001
Posts: 1 Ulfven User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Arrow Apache SSL Virtual Host

I have installed Apache and OpenSSL and it seems to work great. One problem though.

I want a certain vhost to be protected, i.e. URL But unfortunately when I connect to URL I arrive at secure.domain.com (which is on the same IP).

Doesn't Apache check for ServerName when someone connects through SSL? Or is this perhaps a limitation in SSL?

I would like it to return a Not Found message if someone attempts to SSL-connect to any other vhost than secure.domain.com.

Reply With Quote
  #2  
Old September 26th, 2001, 11:30 AM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
>> I would like it to return a Not Found message

Sending 404 in return is inappropriate. Use a customized 400 error instead.

>> Doesn't Apache check for ServerName when someone connects through SSL?

When the cn (common name) mismatches, but the users explicitly GRANT the cert, then they will see the content of your default SSL site.

>> Or is this perhaps a limitation in SSL?

Yes, or you can say it's a feature.

Here is a workaround using mod_rewrite (my favorite):

<IfDefine SSL>
<VirtualHost _default_:443>
ServerName secure.domain.com
...
...
RewriteEngine on
RewriteCond %{HTTP_HOST} !^secure\.domain\.com$ [NC]
RewriteRule ^(.+) /server/path/to/error.cgi [T=application/x-httpd-cgi,L]
</VirtualHost>
</IfDefine>

Your error.cgi will not be revealed to visitors, and here is how it may look like:

#!/usr/bin/perl

print "Content-type: text/html\n\n";
print "<html><body>\n";
print "<h1>Bad Request</h1>\n";
print "This site does not support SSL. ";
print "Please <a href=\"http://$ENV{'HTTP_HOST'}$ENV{'REQUEST_URI'}\">click here</a>\n";
print "</body></html>";

As you can see, say a user visits https://www.vhosts.com/path/to/foo.html , he will then be asked to click on the link to visit http://www.vhost.com/path/to/foo.html instead. In addition, say https://secure.domain.com/path/to/foo.html exists coincidentally, that user will not be redirected to it, just because your error.cgi will intercept the request.

Let me know if you have any question.

Last edited by freebsd : September 26th, 2001 at 01:32 PM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationApache Development > Apache SSL Virtual Host


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway