[squid-users] deny_info redirect with URL placeholder

Amos Jeffries squid3 at treenet.co.nz
Mon Dec 9 09:03:39 UTC 2019


On 9/12/19 8:49 pm, Vieri Di Paola wrote:
> Hi,
> 
> Is there a way to add a URL variable name to a deny_info 302
> configuration directive?
> 

<https://wiki.squid-cache.org/Features/CustomErrors> or as I showed
earlier with logformat codes. Though sorry that does require a later
Squid version that the one you have.


> Suppose I have the following:
> 
> external_acl_type location_rewriter ttl=86400 negative_ttl=86400
> children-max=80 children-startup=10 children-idle=3 concurrency=8
> %<h{Location} /my/rewrite_helper.pl -debug=1
> acl bad_Location external location_rewriter
> deny_info 302:URL_FROM_LOCATION_REWRITER bad_Location
> acl 302 http_status 302
> http_reply_access deny 302 bad_Location
> 
> How can I dynamically replace URL_FROM_LOCATION_REWRITER with the URL
> redirection value produced by the helper script /my/rewrite_helper.pl?
> Could it be possible to refer to the values of "message=" or "tag="
> depending on the result output of the helper script?

Not in Squid-3. The tag= is not supported by the deny_info template
codes. Only the message= can be used.


> How could I refer to these values in the deny_info 302:%* line?

 deny_info 302:https:%o bad_Location

This should do it for Squid-3 (and avoids the config parser bug). You
just have to have the helper produce the URL (without the "https:"
scheme name) as its message= value.


Amos


More information about the squid-users mailing list