[squid-users] deny_info / url_rewrite_program

Amos Jeffries squid3 at treenet.co.nz
Wed Dec 2 16:30:10 UTC 2015


On 2/12/2015 3:17 a.m., Jens Kallup wrote:
> Hello,
> 
> bellow, a Perl script that works for me - it redirect the
> URL in browser; when i type in "web.de" the result is
> "www.freenet.de".
> But the browser don't connect to www.freenet.de,
> he shows me a Error: redirect-error - this problem can
> be, when Cookies deactivated or denied.
> (iceweasel - firefox)
> Is that a browser mistake or my logic?

Maybe both. If you are trying to redirect a CONNECT request or such.

HTTP is not the only protocol Browsers do these days, and the others
generally use CONNECT when going through a HTTP-only proxy like Squid.

Alternatively the browser message might be meaning to say that 301 is an
invalid status response for whatever application process it was
performing before starting to go to that URL. CONNECT is the usual one
due to HTTPS popularity these days, but the CORS and HSTS security
systems can also have sequences of HTTP messages that are expecting
specific non-3xx responses.

> 
> #!/usr/bin/perl -l
> 
> $|=1;                   # don't buffer stdout
> 
> while (<>) {            # read line from STDIN (squid input)
>   $url = m/^([^ ]*)/;
>   if ($url !~ /^http:\/\/web\.de/) {
>     print "301:http://www.freenet.de/index.html\n";
>   } else {
>     print "$url\n";
>   }
> }

That helper is using Squid-2 protocol syntax.

Squid is translating it to its own current syntax. But the helper should
really output the protocol its Squid is wanting to use.

Amos



More information about the squid-users mailing list