Search squid archive

How to diagnose redirector?

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

 



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


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

  Powered by Linux