Link to home
Start Free TrialLog in
Avatar of exclaimer
exclaimer

asked on

Access Two Sub-domains on Different Servers using only one IP Address

Hello,

I have a dilemma which I hope the community can help me resolve. I have created two sub-domains and each will be hosted on different servers. Internally I have no problem connecting to either one.

The problem is when I try to connect from outside our network. We have a single IP address with multiple web servers in-house. I have tried using host headers with redirect to no avail. I tried setting up virtual hosts with redirect, also no go. If at all possible, I would like to avoid having to use specific ports for each site.

Internal DNS obviously works. Externally, I pointed both sub-domains to our IP address.

Main site (www.mydomain.com) = IIS6
Sub1 (sub1.domain.com) = LAMP server hosting WordPress blog
Sub2 (sub2.domain.com) = custom app server

What am I doing wrong? I know I'm missing some piece of the puzzle.

Thank you.
ASKER CERTIFIED SOLUTION
Avatar of brwwiggins
brwwiggins
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Well, I think you could solve it with 301 (permanent) redirect and host headers.

Decide which server will be the "primary" and create BOTH sub-domains on this server. Leave the server's native hosted sub-domain intact, but for another sub-domain create PERMANENT redirect to http://sub2.domain.com.
This will redirect locally to 2nd server, but I am not 100% sure if this would work.
That would work internally but I don't think that would work externally.

The trouble with this is that all of the domain names including the sub domain names all resolve to the same external IP address. So while you can redirect to a different name, it still will resolve to the same single outside IP address in which only can go to a single internal server on port 80.
I think must use (as you mentioned) different ports for each site to be able to map one IP to three different servers.  That is assuming you have only a firewall between the public network and your servers.   A firewall is generally not looking at the HTTP level and so can't act based on http headers.

If, as brwwiggins suggests, you have a reverse proxy or load balancer, they you can direct traffic based on the HTTP header (hostname).
Avatar of xcomiii
xcomiii

Forefront TMG or UAG 2010 are perfect candidates for situations like this.

You need a firewall or application level gateway that can redirect based on HTTP headers instead of IP addresses (like a normal firewall does), and TMG and UAG can both serve that purpose.
Avatar of exclaimer

ASKER

Thank you all.  After further research, I believe setting up a reverse proxy will solve my issue.  Thank you brwwiggins for pointing me in that direction.