Keeping Sessions Open after vcl_error

Lasse Karstensen lkarsten at varnish-software.com
Fri Apr 26 10:35:43 CEST 2013


On Thu, Apr 18, 2013 at 12:54:49PM -0400, Bruce Rudolph wrote:
[..]
> A timeout will occur after 4ms if no response from the backend is received after the request is forwarded. When a timeout occurs a synthesized response is added to an override of the vcl_error function in the default.vcl file. The synthesized response is supposed to keep the session open. Based on the documentation and from my observations in the environment when an error occurs in Varnish, as in a timeout, it causes a SessionClose.

Any request fulfilled by vcl_error will lead to a closed connection.


> Is there a way to keep the session open while sending a synthesized response?

There is a workaround in return(restart) from vcl_error. Set a req.http.x-foo
marker first, so you have something to check for in recv.

In recv you change the backend to something that produces your error page,
this can of course have infinite TTL to get a cached/quick response.

Keepalive works as expected from then on.

-- 
With regards,
Lasse Karstensen
Varnish Software AS



More information about the varnish-misc mailing list