Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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 should preface this with stating that I know basically nothing about proxies (despite having written a toy caching proxy a while back :)).

I have a small cluster of servers running behind a firewall. One of these servers ("server0") can be connected to via http on port 8080, the rest are blocked off. I would like to set up a proxy on server0 so that it forwards requests to server1, server2, etc.

I would also like to configure my client machines (all running Ubuntu) to use the proxy on server0:8080 , but only for urls that hit server* , not for the rest of the traffic. So far I've only been able to find instructions for setting up a proxy for all traffic, not just that which matches some regex.

Is this possible? Any hints / links / etc?

Also recommendations on the appropriate choice of proxy software would be great.


share|improve this question
up vote 2 down vote accepted

Personally I use varnish as a reverse proxy (that I find much more to the task, as opposed as Squid which was not born as a reverse proxy) and it does have advanced feature to redirect traffic to different content backends depending on whatever you want (round robin, regular expressions, load balancing... it's really powerful). If you're interested in it, I can elaborate more on the point.

About the second part of the question (using a proxy only for some addresses) you can use a PAC file as simple as:

function FindProxyForURL(url, host) {
    if (shExpMatch(host, "*"))
        return "SOCKS";
    return "DIRECT";
share|improve this answer

FoxyProxy is a Firefox extension that allows you to configure FireFox so urls that match a particular regex are sent out a particular proxy. This sounds like exactly what you want, but it may be difficult to centrally administer.

It may be possible using WPAD to have a proxy pac file that says only certain URLs go out certain proxies but I'm not sure, would have to research that.

This approach sounds overly complex. I would suggest that it is better to have a central proxy that everyone goes through and then that proxy can itself decide where to forward requests. I believe with Squid you can say "requests to this URL should be forwarded through this other proxy".

share|improve this answer

I think what you're looking for is something like squid (a reverse proxy)

share|improve this answer

Like @mohsen said, sounds like you want a reverse proxy. If squid seems a bit too much trouble to set up, you can try something simple like pound or varnish. Alternatively, something like lighttpd can be configured as a reverse proxy with mod_proxy.

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.