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.
Microsoft IIS Web ServerApache Web ServerDNS

Avatar of undefined
Last Comment
exclaimer

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
brwwiggins

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Andrej Pirman

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.
brwwiggins

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.
Carlo-Giuliani

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).
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
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.
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.