Re: [squid-users] how to use accel url_rewrite_program urlgroup and cache_peer?

From: Sylvain Viart <sylvain.viart@dont-contact.us>
Date: Tue, 02 Oct 2007 14:12:25 +0200

Hi,

Chris Robertson a écrit :
>> incomming URL: somedomaine/path/script.php => should go to peer which
>> host script, php
>> incomming URL: somedomaine/imagepath/someimg.jpg => should go to
>> static peer, filer
>>
>> So I've a redirector which analyze the URL based on some regexp. It
>> was needed for 2.5. Because the redirector script was embedding the
>> round robbing balancing algorithm.
>> I don't find any good doc on how to use all those rewriting url +
>> peer balancing etc. Can someone point me to some good ref?
>
> http://wiki.squid-cache.org/SquidFaq/ReverseProxy#head-7bd155a1a9919bda8ff10ca7d3831458866b72eb
>
Thanks Chris for the link, but I've found this one, and if didn't fit my
need.

I've found by myself.

Here's one solution, for squid Version 2.6.STABLE5:

# put squid in accelerator mode
http_port 80 defaultsite=my.site.com vhost

# some peer (backends/origin server)
# here round robin same weight, you can have lot more server if needed.
found in the FAQ URL above.
cache_peer php-01 parent 80 0 no-query originserver round-robin weight=1
login=PASS
cache_peer php-02 parent 80 0 no-query originserver round-robin weight=1
login=PASS

# + the filer for static content, I add another peer for content filtering
cache_peer filer-01 parent 80 0 no-query originserver name=filergrp

# the redirector, next I will try to remove it and use squid regexep
# it receives and returns the following content: (from cache.log debug
enabled)
# helperSubmit: http://my.site.com/img/file.jpg IP/domain - GET -
# helperHandleRead: '!filer! http://filer-01/img/file.jpg IP/domain - GET -
# it uses the urlgroup to tag the url, here : filer
url_rewrite_program /etc/squid/redirector.pl

# some parameter to config the redirector, here 5 process
url_rewrite_children 5
# which don't know how to handle concurrency
url_rewrite_concurrency 0
# we need to keep the host header not to be rewrote by squid (vhosts
name based)
url_rewrite_host_header off

# one acl for matching the tag urlgroup done by the redirector
acl static_doc urlgroup filer

# filtering to originserver based on acl tagged url
# static_doc (tagged by urlgroup by the redirector + the acl) are
allowed on the filer peer server, nothing else
cache_peer_access filergrp allow static_doc
cache_peer_access filergrp deny all

# static content are note allowed on backend pool, but all other
content, no tagged as static will be load balanced here.
cache_peer_access php-01 deny static_doc
cache_peer_access php-02 deny static_doc

sounds working for me, it also includes some more acl but not related to
accelerator mode reverse proxy.

Here it is.
I may update the wiki because of the lact of documentation using the
urlgroup behavior, also the doc in acl seems wrong:

http://www.squid-cache.org/Versions/v2/2.6/cfgman/acl.html
> acl urlgroup group1 ...
> # match against the urlgroup as indicated by redirectors
Seems to miss the acl_name part => acl acl_name urlgroup group1 ...
no?

It works for me.

Regards,
Sylvain.
Received on Tue Oct 02 2007 - 06:12:37 MDT

This archive was generated by hypermail pre-2.1.9 : Thu Nov 01 2007 - 13:00:00 MDT