Re: [squid-users] Battling with setting up reverse proxy with URL rules

From: Alex Rousskov <>
Date: Wed, 16 Oct 2013 16:36:06 -0600

On 10/16/2013 03:57 PM, Ali Kheyrollahi wrote:

> I would like to (this is a minimal scenario)
> 1) set up a reverse proxy on my local machine on port 3128 (or any)
> 2) have 3 servers, lets call their hostnames: host.serv1, host.serv2
> and host.serv3
> 3) I would like / (root URL) to go to host.serv1
> 4) I would like /foo to go to host.serv2
> 5) I would like /bar to go to host.serv2/baaaz

#3 and #4 can be done using simple cache_peer_access rules with
urlpath_regex ACLs. Here is an untested sketch:

  cache_peer serv1 parent 80 originserver ...
  cache_peer serv2 parent 80 originserver ...

  acl toServ1 urlpath_regex ^/$
  acl toServ2 urlpath_regex ^/foo$

  cache_peer_access serv1 allow toServ1
  cache_peer_access serv2 allow toServ2

I believe the "bar" to "baaz" change in your requirement #5 requires a
URL rewrite using a URL rewriter, eCAP, or ICAP. As Eliezer has said, if
you can do that rewriting on the origin server, do it there.

Do not forget to deal with URLs that do not match any of the three
patterns you have specified.


Received on Wed Oct 16 2013 - 22:36:18 MDT

This archive was generated by hypermail 2.2.0 : Thu Oct 17 2013 - 12:00:06 MDT