[squid-users] Looking to trigger reply_on_error with custom header
rousskov at measurement-factory.com
Mon Nov 7 17:24:28 UTC 2016
On 11/07/2016 08:48 AM, Daniel Dormont wrote:
> the request will return a 200 OK, and the response body
> will be a valid image, but it'll have this extra header:
> x-staticmap-api-warning:Failed to fetch image url
> This should be a transient error, so what I'd like to do is use
> Squid's retry_on_error option to have it just silently fetch the
> upstream image again, but customize what "error" means in this case to
> handle this extra header that Google sends in what's otherwise a 200
> Ok response.
> Unfortunately I'm not all that familiar with Squid at this point. Is
> such a thing even possible? If so, where would I begin?
As you probably know, Squid already has logic to determine which failed
transactions should be retried or reforwarded. That logic is
currently mostly hard-coded. Your options include:
1. Adding a new ACL-driven squid.conf directive to control hard-coded
retry/reforward decisions. This requires Squid development.
2. Using a RESPMOD adaptation service to rewrite Google responses so
that Squid treats them as errors [that should be retried/reforwarded].
This requires research/experiments to confirm that Squid looks at the
adopted message when deciding whether to retry AND adaptation service
More information about the squid-users