Using user defined variable in backend definition?
Nils Goroll
slink at schokola.de
Tue Aug 25 15:28:06 UTC 2020
On 25/08/2020 17:22, Nils Goroll wrote:
> You could do the same thing with a string and the host header or even use a
> string and https://github.com/nigoroll/libvmod-dynamic to turn that into a
> backend at run time.
I noticed that this is probably what you want.
So you might want to consider
/* env.inc.vcl */
sub vcl_init {
new be_name = constant.string("foo.bar.com");
}
/* main.vcl */
vcl 4.1;
import constant; // I forgot this in my previous email
include "env.inc.vcl";
sub vcl_init {
new dyn = dynamic.director();
}
sub vcl_backend_fetch {
set bereq.backend = dyn.backend(be_name.get());
}
More information about the varnish-misc
mailing list