Solved

Https hostnames

Posted on 2006-07-20
5
289 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
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…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

751 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