Re: [squid-users] How to diagnose redirector?

From: Markus Nilsson <markus_at_markusoft.se>
Date: Thu, 10 Nov 2011 13:56:29 +0100 (CET)

----- Ursprungligt meddelande -----
> Från: "Tobias Reckhard" <tobias.reckhard_at_secunet.com>
> Till: "squid-users" <squid-users_at_squid-cache.org>
> Skickat: torsdag, 10 nov 2011 13:20:39
> Ämne: [squid-users] How to diagnose redirector?
>
> Hi
>
> I'm trying to use a url_rewrite_program to redirect my clients from
> one
> specific hostname to another one. For starters, I'm trying to keep
> things simple and have taken the first example Perl script from
> http://wiki.squid-cache.org/Features/Redirectors and modified it sver
> so
> slightly, so it reads as follows:
>
> #!/usr/bin/perl
> $|=1;
> while (<>) {
> chomp;
> @X = split;
> $url = $X[1];
> if ($url =~ /^http:\/\/www\.siegel\.de/) {
> $url =~ s/^http:\/\/www\.siegel\.de/http:\/\/www\.spiegel\.de/;
> print $X[0]." 302:$url\n";
> } else {
> print $X[0]." $url\n";
> }
> }
>

I might be wrong here, but I believe the URL is the first item, i.e.

$url = $X[0]

The second part is the IP, and the third the username, e.g.

http://www.siegel.de 1.2.3.4/- -

/Markus

> It works fine when I call it from the command line (note the inserted
> 'p'):
>
> # echo foobar http://www.siegel.de | ./redirect.pl
> foobar 302:http://www.spiegel.de
>
> However, it appears to have no effect on URLs requested of the squid
> running on the system. I have apparently specified the
> url_rewrite_program in squid.conf correctly, as squid refuses to
> start
> if I rename the file specified. Here are the relevant lines from
> squid.conf:
>
> # grep url_rewrite /etc/squid/squid.conf | grep -v "^#"
> url_rewrite_program /etc/squid/redirect.pl
> url_rewrite_children 5
> url_rewrite_concurrency 0
> url_rewrite_host_header on
>
> Any ideas on how I could approach the problem?
>
> TIA,
> Tobias
>
>
Received on Thu Nov 10 2011 - 12:56:42 MST

This archive was generated by hypermail 2.2.0 : Thu Nov 10 2011 - 12:00:02 MST