Backend response ESI Error handling

L Cruzero lcruzero at
Fri Dec 5 18:09:09 CET 2014

HI, for starters i'm using this piece VLC code within my config to
serve blank html non 200 or 304's. however, the intended goal is so
that it is only applied to an ESI backend response. the names that we
use on our ESI's URLS vary a lot. so i can't just use a RegEx to match
a unique if conditional against obj.response ~  or req.url ~
respectively, i've inserted some bad ESI src tags into a few pages in
hopes of finding a tag within varnishlog on which i could operate.
though so far, no luck.

sub vcl_fetch {
       set beresp.do_esi = true;

       if (beresp.status != 200 && beresp.status != 304 ) {

           error 200 "Not Found";


sub vcl_error {

        synthetic "<html><body><!-- Place holder for backend response
status != 200 && status != 304  --></body></html>";

        set obj.status = 200;

        return (deliver);

any ideas and or thoughts would be appreciated.


More information about the varnish-misc mailing list