<div dir="ltr">Hi Guillaume,<div><br></div><div>There shard algorithm is used for director. That's why it is working. I tried same and able to get exact backend name in v_b_f.</div><div>    new di_utc_0 = directors.shard();<br>    di_utc_0.add_backend(be_utc_16);     <br>    di_utc_0.reconfigure();<br></div><div><br></div><div>But I can not use shard algorithm as requirement is to use fallback/nearest.</div><div><br></div><div>I understood your point that currently no function call available which can provide exact backend.</div><div>Still if any work around for this then please let me know. It is really required.</div><div><br></div><div>Thank you</div><div>Hardik</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 30 May 2019 at 22:48, Guillaume Quintard <<a href="mailto:guillaume@varnish-software.com">guillaume@varnish-software.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Why not share it? I might be missing something.<br clear="all"><div><div dir="ltr" class="gmail-m_3443580449226041704gmail_signature"><div dir="ltr"><div>-- <br></div>Guillaume Quintard<br></div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, May 30, 2019 at 10:10 AM Hardik <<a href="mailto:hetardik.p@gmail.com" target="_blank">hetardik.p@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">Hi Guillaume<div dir="auto"><br></div><div dir="auto"><div dir="auto">Ok..! </div><div dir="auto"><br></div><div dir="auto">Today I saw one VCL where it was resolving actual backend from director in miss/pass function. I have not tried it.  Will let you know how it goes.. </div><div dir="auto"><br></div><div dir="auto">Thank you</div><div dir="auto">Hardik</div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 30 May 2019, 22:23 Guillaume Quintard, <<a href="mailto:guillaume@varnish-software.com" target="_blank">guillaume@varnish-software.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>Getting the resolved backend in v_b_f won't be possible until <a href="https://github.com/varnishcache/varnish-cache/pull/2680" rel="noreferrer" target="_blank">https://github.com/varnishcache/varnish-cache/pull/2680</a> gets merge. In the meantime (unless you write the vmod for it), there's no way to pre-resolve the director.</div><div><br clear="all"><div><div dir="ltr" class="gmail-m_3443580449226041704gmail-m_2410861166985221525m_-5670450063439946762gmail_signature"><div dir="ltr"><div>-- <br></div>Guillaume Quintard<br></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, May 29, 2019 at 6:26 PM Hardik <<a href="mailto:hetardik.p@gmail.com" rel="noreferrer" target="_blank">hetardik.p@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">Thanks Guillaume. <div dir="auto"><br></div><div dir="auto">I am already using bereq.backend in v_b_f which is giving director name.  As you have pointed out,  I want 'exact' backend name inside director.  Also before sending to origin because want to set few  headers for origin as per exact backend. </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 30 May 2019, 04:20 Guillaume Quintard, <<a href="mailto:guillaume@varnish-software.com" rel="noreferrer noreferrer" target="_blank">guillaume@varnish-software.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>man vcl is your friend. I believe what you want is "bereq.backend"<div><br></div><div>Also, you could just write: std.log("using backend: " + bereq.backend)</div><div><br></div><div>note that bereq.backend will return the unresolved backend, meaning that if backends are inside a director, you'll get the name of the director, since the backend choice happens between v_b_f and v_b_r. To know what exact backend was used, you have to check in v_b_r.</div><div><br></div><div>cheers,</div><div><div><div dir="ltr" class="gmail-m_3443580449226041704gmail-m_2410861166985221525m_-5670450063439946762gmail-m_8768346573454730207m_-7614965730516668347m_1688302854719450082gmail_signature"><div dir="ltr"><div>-- <br></div>Guillaume Quintard<br></div></div></div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, May 29, 2019 at 4:56 AM Hardik <<a href="mailto:hetardik.p@gmail.com" rel="noreferrer noreferrer noreferrer" target="_blank">hetardik.p@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Team,<br><div><br></div><div>Requirement : <b>to set few headers based on backend origin ( having multiple origins/backends in single director)</b>.</div><div>                        </div><div>I want to do similar to this. <a href="https://stackoverflow.com/questions/43357690/varnish-vcl-how-can-i-switch-on-req-backend-hint" rel="noreferrer noreferrer noreferrer" target="_blank">https://stackoverflow.com/questions/43357690/varnish-vcl-how-can-i-switch-on-req-backend-hint</a></div><div><pre style="margin-top:0px;margin-bottom:1em;padding:12px 8px;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-stretch:inherit;line-height:inherit;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;font-size:13px;vertical-align:baseline;box-sizing:inherit;width:auto;max-height:600px;overflow:auto;background-color:rgb(239,240,241);border-radius:3px;color:rgb(36,39,41)"><code style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;vertical-align:baseline;box-sizing:inherit;white-space:inherit">sub vcl_backend_fetch {
    if (<a href="http://bereq.backend.name" rel="noreferrer noreferrer noreferrer" target="_blank">bereq.backend.name</a> == "one") {
       std.log("one");
    } else if (<a href="http://bereq.backend.name" rel="noreferrer noreferrer noreferrer" target="_blank">bereq.backend.name</a> == "two") {
       std.log("two");
    } else {
       std.log("neither one");
    }
}</code></pre></div><div><br></div><div>I am trying to do same (inside b_fetch) but getting error that symbol not found. I am using varnish 6.1.</div><div>Is this different function call/name for varnish 6.1 ?</div><div><br></div><div>Thank you</div><div>Hardik</div><div><br></div><div><br></div></div>
_______________________________________________<br>
varnish-misc mailing list<br>
<a href="mailto:varnish-misc@varnish-cache.org" rel="noreferrer noreferrer noreferrer" target="_blank">varnish-misc@varnish-cache.org</a><br>
<a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc</a><br>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>