Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I will first try to describe the problem I have.

Let's say I have two different http servers running on two different ports behind firewall on my local machine:

SERVER1: http://localhost:8001
SERVER2: http://localhost:8002

Now what I want to do is to expose those two trough one port. Let's say trough port 80 like this:

The requirement is also that headers are preserved and that client and end servers will not be aware of proxy in between. So if Digest authentication is present on end servers I expect that it will continue to work like there is no proxy in between.

I guess that this could be achieved with transparent reverse proxy but as this is not my field of expertise I am really not sure whether I am looking at the right direction.

So the questions are:

  • What is proper way to achieve this?
  • Which solutions would make this possible?
  • Is there any other way to achieve same effect like described above?
share|improve this question
[..] end servers will not be aware of proxy in between. Beware that the REMOTE_ADDR won't be the IP of the client, but the IP of the proxy. – r_3 Jan 26 '15 at 14:27

This depends on your reverse proxy product, but this is something that is definitely possible. We use MS TMG for this purpose, it can let clients authenticate directly to the backend, and it can proxy ports as well, but other reverse proxy solutions should be able to do the same.

share|improve this answer

This is very possible, and quite easy with something like HAProxy.

Your fontend/backend config would look something like this.

frontend http-in
  bind *:80
  mode http
  option forwardfor
  acl isServer1  hdr(host) -i
  acl isServer2  hdr(host) -i

  use_backend server1 if isServer1
  use_backend server2 if isServer2

backend server1
  mode http
  server server1 check

backend server2
  mode http
  server server2 check
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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