Help on converting this V3 line to V4

Viktor Villafuerte viktor.villafuerte at optusnet.com.au
Sun Mar 22 23:43:14 CET 2015


Hi Raymond,


On Thu 19 Mar 2015 10:07:01, Jennings III, Raymond wrote:
> (1)
> I changed vcl_error to vcl_backend_error but having a problem with the
> internal syntax.  I used to have:
> 
> sub vcl_backend_error {
> 
>  synthetic {"<p>"} + obj.response + {"</p>"};
>  return(deliver);
> }

I'm using this like this:
(this is from the migrate v3 to v4 page)

synthetic( {"<p>"} + resp.http.response + {"</p>"} );
return(deliver);


> 
> (2)
> I also had this line in my V3 vcl
> 
> error 200 "BAN Set for " + req.url;
> 
> Does this get converted to:
> 
> set resp.status = 200;
> synthetic("BAN Set for " + req.url);
> return(deliver);
> 
> 
> The Upgrading page says this:
> 
> error() is now synth()
> <https://www.varnish-cache.org/docs/trunk/whats-new/upgrading.html#error-is-now-synth>
> 
> And you must explicitly return it:
> 
> return (synth(999, "Response"));
> 

You need to do exactly what the page says

return(synth(ERR_NO, "Error message"));

Then in vcl_synth you can do smth like

if (resp.status == ERR_NO) {
    do_smth_here;
}


> 
> Not sure exactly what is going on here.
> 
> Thanks for any insight.
> 
> Ray

> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc


-- 
Regards

Viktor Villafuerte
Optus Internet Engineering
t: 02 808-25265



More information about the varnish-misc mailing list