Single domain name potentially resolving to multiple servers

Posted by Jace on Server Fault See other posts from Server Fault or by Jace
Published on 2012-10-31T06:36:52Z Indexed on 2012/10/31 11:03 UTC
Read the original article Hit count: 230

Filed under:
|
|

first time here at Server Fault, and I apologize in advance that this domain stuff is not really my strength. Any and all suggestions are much appreciated. I am completely lost and incredibly tired!

I've inherited an incredibly convoluted system from my predecessor, and I'm trying to find a way to solve it - or I need to be told that it just isn't possible.

  • I've got an old site on ServerA (some kind of Linux distribution), with the domain SomeDomain.com
  • There is a new site sitting on ServerB (Ubuntu), with the intention of having SomeDomain.com to serve it in the future (it is replacing the old site)
  • ServerA also has a web app that is currently in use by other departments within the company (accessible at SomeDomain.com/web-app/)

The goal: To have SomeDomain.com and all extensions of this domain name (sub-domains, URL's etc.) serve the new site on ServerB. BUT, the URL SomeDomain.com/web-app/ must serve the Web App on ServerA.

The Catch: The ServerA is a shared server with a hosting company with VERY limiting restrictions in place - I cannot adjust DNS settings (apart from Name servers - but cannot set A records or anything, I have full access to ServerB to do as I wish). Therefore the web-app MUST be served from SomeDomain.com/web-app/ and not from a sub-domain or anything. These limitations make migrating the web-app from Server A to Server B rather undesirable, AND this web-app will be replaced in the near future, so it isn't worth the effort right now.

Therefore, ultimately I will want 1 domain name to resolve to Server B's IP address most of the time, but in the event that the URL is SomeDomain.com/web-app/, it should resolve to Server A's IP.

Note: The domain names don't, technically, have to resolve to one IP or another - but ultimately the URL's must stay consistent

Some things I have tried:

  • I've looked into mod_rewrite and .htaccess to try and achieve this effect, but it doesn't look like it's going to work for me - but I may have done it wrong (On Server B, I just checked if the request URI was /web-app/ and tried to serve the /web-app/ folder on Server A)
  • I do have the ability to modify the name servers on both servers
  • I am not able to make a sub domain on Server A that points back to Server A (I assume because the hosting company's servers use the URL to determine what site the serve). I figured this could be good as I'd could set an A record on Server B to point to the web app on Server A - but alas, Server A requires SomeDomain.com.

If there is any more information I can give, please let me know. I need a nudge in the right direction, ideas or a solution.

© Server Fault or respective owner

Related posts about apache2

Related posts about dns