Re: Save 15% on your bandwidth...

From: Brian Denehy <B-Denehy@dont-contact.us>
Date: Fri, 20 Sep 1996 13:29:42 +1000

|
| On Sun, 15 Sep 1996, Gudmundur Ragnar wrote:
|
| > > > > Why not just add a special rule in squid so that netscape
| > > > > distributions get cached *much* longer? ;-)
| > > >
| > > > The point is that there are many mirrors around the world and our
| > > > users tend to visit them all.
| > >
| > > Is there anyway that I could redirect all requests to
| > > ftpx.netscape.com/blabla/n32.exe to the same ftp site e.g.,
| > > ftp5.netscape.com and then write a ttl_pattern rule so that this
| > > site only stays longer.
| >
| > We have a real "problem/opertunity" and should try to find a solution
| > that is both simple and complete.
|
| some sort of regexp url rewriting would be useful:
|

From the 1.1 Release notes (still at beta3, but pretty stable)

URL Redirector
==============================================================================
Squid now has the ability to rewrite requested URLs. This is implemented
as an external process, much like the dnsservers. Every incoming URL
is written to a 'redirector' process which then returns a new URL, or
a blank line to inidicate no change.

The redirector program is NOT provided in the Squid package. Currently,
it is up to the individual users to write their own implementation. For
testing, this very simple Perl script can be used:

    #!/usr/local/bin/perl
    $|=1;
    print while (<>);

The redirector program must read URLs (one per line) on standard input,
and write rewritten URLs or blank lines on standard output. Note that
the redirector program can not use buffered I/O. Additional information
is written after the URL which a redirector can use to make a decision.
The input line consists of four fields:

    URL ip-address/fqdn ident method

The ip-address is always written, the fqdn will be provided if
available (otherwise it will be "-"). Similarly, the user ident will
be provided if available (i.e. 'ident_lookup on' in config file). The
method is GET, POST, etc..

Note that when used in conjunction with the -V option (on a virtual hosted
machine) this provides a mechanism to use a single Squid cache as a front
end to numerous servers on different machines. URLs written to the
redirector will look like:

    http://192.0.0.1/foo
    http://192.0.0.2/foo

The redirector program might be this Perl script:

    #!/usr/local/bin/perl
    $|=1;
    while (<>) {
        s@http://192\.0\.0\.1@http://www1.foo.org@;
        s@http://192\.0\.0\.2@http://www2.foo.org@;
        print;
    }

You may receive statistics on the redirector usage by requesting the
following 'cache_object' URL:

    % client cache_object://localhost/stats/redirector

-- 
Brian Denehy,			   Internet: B-Denehy@adfa.oz.au
IT Services 		  	   MHSnet:   B-Denehy@cc.adfa.oz.au
Australian Defence Force Academy   UUCP:!uunet!munnari.oz.au!cc.adfa.oz.au!bvd
Northcott Dr. Campbell ACT Australia 2600  +61 6 268 8141  +61 6 268 8150 (Fax)
Received on Thu Sep 19 1996 - 20:30:21 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:33:03 MST