<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
</head>
<body>
<div class="moz-cite-prefix">On 24/08/2020 19:42, Batanun B wrote:<br>
</div>
<blockquote type="cite"
cite="mid:AM7PR08MB5416E0DC893274458356561DAC560@AM7PR08MB5416.eurprd08.prod.outlook.com">
<div style="font-family: Calibri, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
So, I would like something like this to work:</div>
</blockquote>
<p>With the "constant" vmod from
<a class="moz-txt-link-freetext" href="https://code.uplex.de/uplex-varnish/varnish-objvar">https://code.uplex.de/uplex-varnish/varnish-objvar</a> you can do
something like this</p>
<p><br>
</p>
<p>/* backends_X.inc.vcl */</p>
<p>backend foo {</p>
<p> .host = "127.0.0.1";</p>
<p>}<br>
</p>
<p>sub vcl_init {</p>
<p> new envbackend = constant.backend(foo);<br>
</p>
<p>}</p>
<p><br>
</p>
<p><br>
</p>
<p>and then in your main vcl include "environment.vcl", which points
to some variant of the above and do</p>
<p>sub vcl_backend_fetch {</p>
<p> set bereq.backend = envbackend.get();<br>
</p>
<p>}</p>
<p><br>
</p>
<p>See
<a class="moz-txt-link-freetext" href="https://code.uplex.de/uplex-varnish/varnish-objvar/blob/master/src/vmod_constant.rst">https://code.uplex.de/uplex-varnish/varnish-objvar/blob/master/src/vmod_constant.rst</a>
for more details on the constant vmod</p>
<p><br>
</p>
<p>You could do the same thing with a string and the host header or
even use a string and <a class="moz-txt-link-freetext" href="https://github.com/nigoroll/libvmod-dynamic">https://github.com/nigoroll/libvmod-dynamic</a>
to turn that into a backend at run time.</p>
<p><br>
</p>
<p>hf, Nils<br>
</p>
</body>
</html>