Hi

we use something like:

sub vcl_deliver {
    # reformat errors in ESI requests
if ( resp.status >= 300 && (req.esi_level > 0 || req.http.X-Esi ~ "\d") ) {
        return(synth(resp.status,resp.reason));
    }
}

sub vcl_synth {
...
    if ( req.esi_level > 0 || req.http.X-Esi ~ "\d" )  {
synthetic("<!-- ESI error " + resp.status + " " + resp.reason + " URL: '//" + req.http.quotedUrl + "' xid: " + req.xid + " -->");
    }
    else {
        ...
    }
    return(deliver);
}

tom

Am 16.02.2016 um 19:51 schrieb Andrew Bailey:
Hi,

I am using varnish 4.1 and would like to implement something similar to

<esi:include src="apage-head.html" onerror="continue"/>

which does not appear to be supported yet.

I have:

sub vcl_backend_response {
        if (bereq.url ~ "-head.html$"  && beresp.status==404)
#if (req.esi_level>0 && beresp.status==404) //Commented as Variable not available
        {
#set beresp.status = 700; //this is for attempts to forward to vcl_synth
                set beresp.status = 200;
                set beresp.http.Content-Type = "text/html; charset=utf-8";
                set beresp.reason="esi include failed with a 404";
#synthetic("<!-- esi include failed with a 404-->"); # not a valid action from method
                #call vcl_synth; # still cant use synthetic
                #call vcl_backend_error; #ditto
                return (deliver);
        }

I think it should be valid to call synthetic here, any chance of this for a future version?

Also I tried to see if it is in the middle of esi processing using req.esi_level however that is not available in this method.

 I have tried several workarounds
return(synth ...)
call vcl_synth
but no luck.

Can anyone provide a working solution.


thanks in advance

Andrew Bailey


_______________________________________________
varnish-misc mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc


Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
varnish-misc mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

Reply via email to