Search squid archive

Re: Fwd: Url redirection to ip

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 14, 2008 at 04:31:35PM -0400, jason bronson wrote:
> Is it possible to redirect based on a URL path in squid example
> 
> I have
> 63.45.45.45/login/test
> 63.45.45.45/login/new
> 
> 63.45.45.45/login/test  --> 10.108.111.34
> 63.45.45.45/login/new  --> 10.108.18.254
> 
> So I want to redirect squid's call based upon its external path
> being seen then send to the correct machine

You need to configure a cache_peer for each backend server you want
to serve from:

cache_peer 10.108.111.34  parent  80  0  name=test no-query no-digest originserver
cache_peer 10.108.18.254  parent  80  0  name=new  no-query no-digest originserver

The "originserver" option tells squid not to make proxy requests to
it, i.e. to request /foo/bar rather than http://server/foo/bar.

The "name" option lets you refer to the cache_peer with something
other than its IP address, which can make your configuration more
readable and is especially useful if you have multiple servers on
the same IP but a different port.

You then define acls to specify what traffic to allow or disallow to
each of these peers, and apply them with cache_peer_access:

acl test_server_paths url_regex 63\.45\.45\.45/login/test
acl new_server_paths url_regex 63\.45\.45\.45/login/new

cache_peer_access test allow test_server_paths
cache_peer_access test deny all

cache_peer_access new allow new_server_paths
cache_peer_access new deny all

You can probably come up with more efficient rules, but that's the
general approach. The "test" and "new" in the cache_peer_access
lines correspond to the name= assigned to each cache_peer; if you
don't explicitly set a name= you just use the hostname or IP address
of the peer.

[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux