[squid-users] deny_info / url_rewrite_program

Antony Stone Antony.Stone at squid.open.source.it
Mon Nov 30 18:11:13 UTC 2015


On Monday 30 November 2015 at 19:00:14, Jens Kallup wrote:

> 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

I'm assuming that you actually mean you've added the second line above with no 
comment # at the start (otherwise of course it does nothing), however are you 
sure this is supposed to work with the ! negation in the ACL?

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

Do you get any warnings when starting Squid (when it reads squid.conf), and 
what appears in your access.log when you attempt to connect to a URL which you 
expect to trigger these rules?

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

The format of the line above should be:
	OK status=301 url="http://www.freenet.de"

>          #my $output = "OK user=$user status=302
> url=http://www.freenet.de/\n";
>          print STDOUT $output;
>      }
>      else {
>          print STDOUT $url."\n";

Surely the above line should just be:
	print STDOUT "OK\n"

>      }
> }

See http://www.squid-cache.org/Doc/config/url_rewrite_program/ for syntax 
details.



Antony.

-- 
There's no such thing as bad weather - only the wrong clothes.

 - Billy Connolly

                                                   Please reply to the list;
                                                         please *don't* CC me.


More information about the squid-users mailing list