[prev in list] [next in list] [prev in thread] [next in thread] 

List:       varnish-misc
Subject:    Re: Masquerade backend errors on 4.0.x
From:       Cédric Jeanneret <varnish () tengu ! ch>
Date:       2015-07-24 6:33:53
Message-ID: 55B1DC51.1060703 () tengu ! ch
[Download RAW message or body]

Hello,

Just found out: documentation is wrong, vcl_deliver DOES support "synth"
as a return function…

This showed the support:
https://gist.github.com/mjf/ddae14982720f77b665a#file-varnish_cache_subroutines-rst

and a test validated it. So now I can do a synthetic(""); in vcl_synth
if we get a 204 status.

Might be good to update/correct this page:
https://www.varnish-cache.org/docs/4.0/users-guide/vcl-built-in-subs.html#vcl-deliver

Cheers,

C.

On 07/24/2015 07:56 AM, Cédric Jeanneret wrote:
> 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.
> 
> _______________________________________________
> varnish-misc mailing list
> varnish-misc@varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
> 

_______________________________________________
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic