Exposing real backend name in vcl_recv

s u slaweuk at googlemail.com
Tue Jul 13 16:06:10 CEST 2010


Hi everyone,

I'm trying to alter req.url to custom value based on backend that Varnish
will use.

Following config snippet worked fine before I've switched to director:

--------------------- 8-< ---------------------

#set req.backend = index3;  # direct connection to backend
set req.backend = search;  # using rr director (for index3 and 4)

if ( req.url ~ "^/solr/round-robin" ) {

   if ( req.backend == index3 ) {
     set req.url = regsub(req.url, "round-robin", "index3");
   }

   if ( req.backend == index4 ) {
     set req.url = regsub(req.url, "round-robin", "index4");
    }
}

--------------------- >-8 ---------------------

Is there way to access the real backend's name - or something else - which
would tell me to which backend a request will be sent during the recv phase?

Kind Regards,
Slawek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20100713/78934067/attachment-0003.html>


More information about the varnish-misc mailing list