RE: [squid-users] Redirecting to different server based onURLpattern

From: Henrik Nordstrom <henrik@dont-contact.us>
Date: Thu, 14 Jun 2007 00:01:34 +0200

ons 2007-06-13 klockan 14:26 +0000 skrev Jacobson, Martin:
> I believe that I am getting closer but want to make sure before changing
> my squid configuration file.
>
> Currently I have it set up using the httpd_accel_host and
> httpd_accel_port
> # IP of server
> httpd_accel_host 172.16.7.199
> # Port
> httpd_accel_port 80

Still using Squid-2.5? Upgrade to 2.6.

> After reading over these links, I believe that I need to comment out the
> above lines and add something like:

You will need the above for Squid-2.5.

Squid-2.6 is quite different, and is what the FAQ documents.

> cache_peer 172.16.7.199 parent 80 0 no-query originserver name=server1
> cache_peer 172.16.10.36 parent 9000 0 no-query originserver
> name=server2
> acl bin urlpath_regex ^/cgi-bin/
> cache_peer_access server2 allow bin
> cache_peer_access server1 deny bin
>
> This should pass all requests coming through the squid to server1 unless
> it has /cgi-bin/ in the URL. Then it will be passed to server2 port
> 9000.

Looks fine.

For 2.5 you'll also need

never_direct allow all

(doesn't hurt in 2.6 either, but it's implicit in reverse proxy setups)

> Now I don't want squid to keep a cached copy of the page returned by
> either server1 or server2. I need squid to always pass the request to
> the correct server. Will the above configuration do this, or do I need
> to set another configuration flag?

You need to either disable caching using the cache directive (no_cache
in 2.5), or make the peers proxy-only, whichever suits your setup best.

Regards
Henrik

Received on Wed Jun 13 2007 - 16:01:43 MDT

This archive was generated by hypermail pre-2.1.9 : Sun Jul 01 2007 - 12:00:04 MDT