Re: [squid-users] Is there a way to select a cache peer before URL rewrite occur ?

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Tue, 09 Jun 2009 15:43:15 +1200

On Mon, 8 Jun 2009 16:56:57 -0300, Lucas Brasilino
<lucas.brasilino_at_gmail.com> wrote:
> Hi all:
>
> I wonder if it's possible to select a peer before URL rewrite takes
> place. This my scenario:
>
> I've got 2 domains: www.foo.org and www.bar.org, and a rewriter that
> does the following rewriting:
>
> www.foo.org => localhost/foo
> www.bar.org => localhost/bar
>
> My config is:
>
> cache_peer localhost parent 1080 0 originserver name=foo
> cache_peer localhost parent 1081 0 originserver name=bar
>
> acl bar_acl dstdomain .bar.org
> acl foo_acl dstdomain .foo.org
> cache_peer_access foo deny bar_acl
> cache_peer_access bar deny foo_acl
>
> Will not work. Debuging section 28 I saw that 'cache_peer_access' is
> checked
> *after* the URL rewrite, so It does against 'localhost/foo' and
> 'localhost/bar', not
> against 'www.foo.org' or 'www.bar.org'.
>
> I know that using 'url_regex' it'll work. But since 'dstdomain' (and
> others)
> uses splay tree, it's less CPU intensive than using regexes.... In such
> busy
> sites it makes a large difference.
>
> Any tip ?

The problem being that after the re-write the destination domain has in
fact altered. Whether a peer is involved or not. That is what re-writing
means.

Make the web server at localhost understand that it has two public domains
being serviced.
Only re-write the path portion of the domain to get the right file path, if
at all. Removing the need for re-writing will give a further large increase
in speed.

Amos
Received on Wed Jun 10 2009 - 23:45:23 MDT

This archive was generated by hypermail 2.2.0 : Thu Jun 11 2009 - 12:00:03 MDT