Masquerade backend errors on 4.0.x
Cédric Jeanneret
varnish at tengu.ch
Fri Jul 24 07:56:45 CEST 2015
Hello,
I'm having some troubles trying to masquerade backend error with varnish
4.0.x.
Lemme explain:
queries are sent to some backend server, which might return either 403
or 200 HTTP code, both with content (403 will explain "access denied"
with some random string, blah).
My aim is to override the 403 error with "204" (no content) and deliver
an empty content.
Issue so far: I can set the response status to 204, but I'm unable to
deliver an actual empty body and varnish still sets the header
Content-Length to the backend answer length.
My thought were to put some "return(sync(204))" in vcl_backend_response,
but this subroutine is unable to return "synth"; I tried to mess a bit
in vcl_deliver, but there as well, unable to return "synth".
Of course, "unset *.http.Content-Length" doesn't work.
We really need to return 204 with no content, as:
- an application would display some bad stuff if we don't return 204
- other applications crash weirdly if we do return 204 with a
Content-Length above 0
I'm pretty sure the vcl_deliver should be able to return synth() in
order to allow body/content override, but… it doesn't seem to be the
case in varnish 4.0.x :(.
Any thought or advice?
Thanks!
Cheers,
C.
More information about the varnish-misc
mailing list