Solved

Https hostnames

Posted on 2006-07-20
5
290 Views
Last Modified: 2010-03-04
Hi.
I have one public ip, that I want to have multiple subdomains.
The subdomains will use one wildcard certification, that will cover theme all.
Problem is that when using https, we can only have one virtual host on each ip:443.
so how would one have apache presenting visitors different data according to witch hostname is used?
test1.mydomain.com -> /var/www/test1
test2.mydomain.com -> /var/www/test2
If the solution is to set up a redirection, I want it to be transparent to the user.
0
Comment
Question by:thor918
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 13

Expert Comment

by:rhickmott
ID: 17147787
Unfortunatly this is a bit like a chicken and egg scenrio as the SSL session is setup and established before the headers are sent so until the SSL connection is established the headers and more importantly the "host" field are not sent so its not possible to have name based SSL virtualhosts.

You can have IP based onses so you can assign two IPs to your server and have site1. running off one IP and site2. running off another but you will need two public IP addresses to get them both working properly.

The only way you could maybe do it is with mod_rewrites but the certificate will only be valid on one host test1. or test2. the other would complain about the certificate not being valid for the site.
0
 
LVL 2

Author Comment

by:thor918
ID: 17147879
I'm using wildcard certificate.
this means it's valid for the whole domain, including all subdomains.
0
 
LVL 2

Author Comment

by:thor918
ID: 17149031
As you probably see, I have read up on the topic before I asked. so I know that it is difficult, but I belive it should be possible to have some sort of redirect.
I got a php redirect right now, that works ok.
but I would like to see it redirect transparent. I think I read somewhere before that it is possible to redirect content transparent from the user.

I also tried something that worked pretty good, but was broken in one case I had to use a webdav service.
I used a apacheproxy to redirect output from http://localhost. and let the normal virtualhostname be taken care of there.
That worket perfect, exept that webdav refused to stay in https.

so I would be very happy if I could make a simple htaccess script that redirects content from another folder located on the same server (and the redirect is transparent from the visitor.).
0
 
LVL 27

Accepted Solution

by:
caterham_www earned 500 total points
ID: 17149556
>>Problem is that when using https, we can only have one virtual host on each ip:443.
so how would one have apache presenting visitors different data according to witch hostname is used?
test1.mydomain.com -> /var/www/test1
test2.mydomain.com -> /var/www/test2<<

How does your DocumentRoot directive look like? I'm assuming /var/www

Inside of your <virtualhost> with the module mod_rewrite loadded

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTP_HOST} ^([^.]+)\.mydomain\.com
RewriteRule ^/(.*) /%1 [PT]
0
 
LVL 2

Author Comment

by:thor918
ID: 17149682
@caterham_www
I did't get what you posted working, but you helped me on the right path
here is what I ended up with. it works perfect.

            RewriteEngine On
            RewriteCond %{HTTP_HOST} ^websvn\.mydomain\.net$ [NC]
            RewriteRule ^(.*)$ /websvn/$1 [L]

            RewriteCond %{HTTP_HOST} ^svn\.mydomain\.net$ [NC]
            RewriteRule ^(.*)$ /mysvn/$1 [L]
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

634 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question