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
Solved

Https hostnames

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

Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
file path 14 71
Apache SSL and mod_rewrite not working 8 182
PHP Register global 21 95
REWRITE RULE - Forcing https to http for Non-SSL site using HTACCESS 9 149
Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

792 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