[squid-users] deny_info / url_rewrite_program

Jens Kallup jkallup at web.de
Mon Nov 30 18:00:14 UTC 2015


Hello,

I have try a "url_rewrite_program" that should redirect a page,
that content is filtered / changed.
I add 2 lines to config:

url_rewrite_program /sap/squid/rewrite.pl
#deny_info http://www.freenet.de !mysql_blocker

both cases don't work.
How can I fix that?

Here the perl script:
#!/usr/bin/perl -l

#use strict;
use warnings;
use IO::Handle;
use URI::Escape;
use DBI;
use 5.010;

$|=1;                   # don't buffer stdout

while (<>) {            # read line from STDIN (squid input)
     my ($url, $ip, $slash, $fqdn, $user, $method) = split;

     $url = uri_unescape($url);
     $nxt = uri_unescape("www.google.de");

     if ($url eq $nxt) {
     my $output = "301:http://www.freenet.de\n";
         #my $output = "OK user=$user status=302 
url=http://www.freenet.de/\n";
         print STDOUT $output;
     }
     else {
         print STDOUT $url."\n";
     }
}



More information about the squid-users mailing list