Re: [squid-users] how can I query squid cache?

From: Henrik Nordstrom <[email protected]>
Date: Fri, 13 Jul 2007 20:06:42 +0200

fre 2007-07-13 klockan 12:22 -0500 skrev ying lcs:

> I tried to look at squirm, but that does not seem to work. Basically,
> I just want to redirect the url from http://www.abc.com to
> http://www.def.com in the squid cache.

If it's sufficient that you redirect the browser to http://www.abc.com
when they requested something from http://www.def.com then using
deny_info works fine..

acl abc.com dstdomain www.abc.dom
http_access deny abc.com
deny_info http://www.def.com abc.com

This will redirect the browser to http://www.def.com on any request for
something on the www.abc.com server.

But if you want Squid to rewrite the requested URL on the fly from
www.abc.com to www.def.com then you need to use an url rewriter helper.
Squirm or one of the other existing redirectors should work for the
purpose, or you could write your own. Writing a url rewriter helper is
not a very complex thing..

#!/usr/bin/perl -p
BEGIN {$|=1;}
s%^([^:]*)://([^/@]*@)?www.abc.com(:|/|\?|$)%$1://$2www.def.com$3% && next;

the above strange things is to support all forms of http URLs pointing
to www.abc.com.. scheme://[user[:password]@]host[:port][/path]

If you just want to support the simplest form http://host then the
pattern is also simpler

s%^http://www.abc.com(/|\?|$)%$1://$2www.def.com$1% && next;

Regards
Henrik

Received on Fri Jul 13 2007 - 12:06:54 MDT

This archive was generated by hypermail pre-2.1.9 : Wed Aug 01 2007 - 12:00:03 MDT