Search squid archive

Re: how can I query squid cache?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 7/13/07, Henrik Nordstrom <henrik@xxxxxxxxxxxxxxxxxxx> wrote:
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

Henrik,
Thank you for your help.
Actually, i want to rewrite the url before squid saves it in its cache.

I assume squid has a mapping table between an URL and  cached file.
Can please point me to the code which does the adding the entries
between URL and cached file?

Thank you.

[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux