I'm setting up a few services which will reside behind a single IP (ie NAT). Some of these services will use the same port. For example, say I would host two different web sites on different servers WebA and WebB. To an external visitor, I want both to use port 80. Determining what server should answer the request should be done by inspecting the url, say that I have weba.example.com and webb.example.com, they should be served from the appropriate server.

At work I know that we do this using F5 loadbalancers and build rules called "iRules". That is massively overkill for my scenario though. What available tools are there to accomplish this? I looked into Zen Loadbalancer since I figured it would be something all loadbalancers do, but it seems not.

3 Answers 3


Squid can function as a reverse web proxy which does what you want - see Reverse Proxy with Multiple Backend Web Servers

You could set the router to forward port 80 to the squid server and let squid forward the request to different internal webservers.


Reverse proxies do exactly what you want, and Apache supports them.

You may experience problems if the web application makes heavy or weird use of Javascript. You also may need to change any configuration the web app uses - some need to be told what URL to return when creating response pages and such.

Here is a guide I've used in the past.


For the web-servers, you could use Apache + virtual hosts + mod_proxy configured as a reverse proxy.

  • Also, it may be worth looking at Pirhana. I have no experience with it, but believe that for multi-protocol LB it may be a solution.
    – gerryk
    Commented Oct 9, 2013 at 21:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .