[squid-users] How to diagnose redirector?

From: Tobias Reckhard <tobias.reckhard_at_secunet.com>
Date: Thu, 10 Nov 2011 13:20:39 +0100

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";
   }
}

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:21:01 MST

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