0

Assuming a setup as seen below, is it possible to route requests for e.g. subdomain1.domain.com to Server 1, subdomain2.domain.com to Server 2, another seconddomain.com to Server 2 etc. without reverse proxies?

The goal is to host several servers which should each be accessible and administered by different persons autonomously. As most of them are test environments the goal is to be able to access each of the servers, on all ports, via a different domain/subdomain name. Managing reverse proxies each time a new service is tested on one of the machines would be quite cumbersome, especially as these are not limited to HTTP/HTTPS web servers and can offer a number of protocols across a number of different ports.

Is such a setup feasible? How would one go about setting it up?

Schematic illustration of proposed setup

4
  • 1
    What you're asking for is pretty much impossible, because the vast, vast majority of L7 protocols have no concept of a hostname, and thus can't be proxied based on a hostname – Mark Henderson Dec 3 '15 at 15:11
  • That's what I understood so far, I was hoping I was wrong. Thank you! – Riley Dec 3 '15 at 15:12
  • 2
    The correct way to achieve what you want is to assign different public IP addresses, because even though you have a router in your diagram, it's actually NATting, which isn't routing at all. So you need more IP addresses, and you can either route fully and put the public IPs on your three servers, OR, you can put the IP addresses on your router and do a 1:1 NAT (eww) – Mark Henderson Dec 3 '15 at 15:13
  • If you need to do HTTP load balancing, you need a reverse proxy. That is what they are built to do. When you say "request" do you mean another TCP protocol? Or is this something HAproxy has solved? – lee Dec 3 '15 at 16:35
3

What you're asking for is pretty much impossible, because the vast, vast majority of L7 protocols have no concept of a hostname, and thus can't be proxied based on a hostname

The correct way to achieve what you want is to assign different public IP addresses, because even though you have a router in your diagram, it's actually NATting, which isn't routing at all.

So you need more IP addresses, and you can either route properly and put the public IPs on your three servers, OR, you can put the IP addresses on your router and do a 1:1 NAT (eww, especially if the NAT uses Proxy ARP to "get" the IPs)

2

The best way to do this is by assign a different IP by server:

  • server1 first public IP
  • server2 second public IP
  • server3 third public IP

Then assign each domain a different IP in the DNS.

If you're ISP can't provide you more IP addresses, then you can migrate elsewhere, or bring the traffic to your servers through tunnels.

2
  • Thank you! Was hoping to avoid tunneling. If that's what it takes we will have to live with it. – Riley Dec 3 '15 at 15:31
  • Just for anyone still looking for an answer, for most it might be sufficient to set up a reverse proxy: nginx.com/resources/admin-guide/reverse-proxy – Riley Nov 11 '16 at 9:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.