Lucas Brasilino 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 ?
Add entries to your hosts file so requests for www.foo.org and www.bar.org are resolved as 127.0.0.1. Then your url_rewrite program can just add the directory (if needed), and you can still use a dstdomain ACL for the cache_peer_access. If the servers at port 1080 and 1081 MUST be accessed by the hostname "localhost", then (in addition to the host file modification) use the forceddomain argument on the cache_peer directives.
regards Lucas Brasilino
Chris