Preventing dup backend names with dynamic backends in VMODs

Kacper Wysocki kacperw at
Fri Oct 30 17:19:30 CET 2015

On Wed, Oct 28, 2015 at 9:17 AM, Poul-Henning Kamp <phk at> wrote:
> In message <562F91DA.8010104 at>, Geoff Simmons writes:
>>> My current thinking is that we'll name the backend whatever the
>>> user/vcl/vmod writer likes (ie:  Backend name), and deal with the
>>> fall-out.
>>At the very least, VMODs should have a way to discover if a backend
>>name is already in use by a VCL -- the VCL_HasBackend(vcl,name) idea.
>>Then a VMOD can choose to raise an error for duplicate names.

>>Maybe add a sentence or two to the "Writing a Director" doc about
>>backend names, what they're used for, and why this could be a problem.
> Adding the .%u suffix makes the situation workable for people who
> make that mistake, and once they have sorted it out, it doesn't get
> in the way for them.

slightly related to this, could we possibly allow accessing the name in VCL,

  if(req.backend_hint ~ "zool") {
     /* do something */

or even

std.log("backend was " + req.backend_hint);

I can imagine this might get tricky with directors, but I for one
would find this useful, even subject to the restrictions/confusions of
duplicate backend names etc


More information about the varnish-dev mailing list