[squid-dev] Problems about Squid documentation/configuration

Amos Jeffries squid3 at treenet.co.nz
Tue Feb 21 23:19:28 UTC 2017

On 22/02/2017 3:04 a.m., Rallph wrote:
> Hello,
> I am actually working on a URL filter that works with Squid and his
> url_rewrite_program.
> I haven't installed SquidGuard or UFDBGuard either on my Debian 8.6 with
> Squid 3.5 (from sources).
> The problem is : I can't find why must my program return to Squid, this page
> http://wiki.squid-cache.org/ConfigExamples/PhpRedirectors#PHP_Redirect_.28Simple.29
> say that the output is "302:http://example.com/\n" ...

That page is written about a very specific helper script someone
created. It is consistent with the AddonHelpers page content, but only
contains a very limited use of the URL rewrite API.

> But when you look at
> http://wiki.squid-cache.org/Features/AddonHelpers#HTTP_Redirection it says
> that the output must be something like "0 OK status=302
> url=http://example.com/\n 302:http://example.com/\n" and it doesn't work.

That page is the most up to date documentation. It contains the *full*
helper protocol and all helper APIs. The sub-section of that relevant to
redirectors is contained in
<http://wiki.squid-cache.org/Features/Redirectors> along with some other
documentations related to redirectors.

The PhpRedirectors page documents a single helper using a specific
sub-set of the redirect protocol applicable to Squid-2 compatible
helpers without concurrency support.

The syntax definitions use [] to indicate optional fields in the protocol.

So as you should see, that PhpRedirectors helper is using *only* the
status:URL field in its response. No channel-ID, result or key=value

Your helper is using channel-ID, result and some kv-pairs. Which is
correct for Squid-3.4 and later.

> I've tried "0 OK status=302 url=http://example.com/\n" but Squid tells me
> "ERROR: URL rewrite helper returned invalid result code. Wrong Helper?
> {result=Unknown}" and I can not find something to fix it.

Use of the concurrency channel-ID requires that squid.conf has enabled
concurrency support with the url_rewrite_children directive.

It looks to me like you are missing that squid.conf part. The helper
should work okay one that is added.

The rest of the issues are all side effects.


More information about the squid-dev mailing list