title: Can we perform mapping or do a lookup of string or KV pair in Varnish `sub vcl_recv`
body: <p>I am trying to route the traffic/connections to backend director based on <code>url</code> parameters which are passed on incoming request.</p>
  <p>Here is my current config</p>
  <pre><code>sub vcl_recv {
      if (req.url ~ &quot;sto&quot;) {
          set req.backend_hint = endpoint1.backend();
      } 
  }
  </code></pre>
  <p>Currently, above config does static mapping/check for <code>sto</code>. I would like to do a dynamic lookup from map/hash/KV file and do condition check with <code>url</code> contents.</p>
  <p>Here is how I do it in <code>haproxy</code></p>
  <pre><code>    use_backend %[path,map_sub(/etc/haproxy/GET.map)]
  </code></pre>
  <pre><code>#&gt;cat GET.map
  # url paramter      backend location/name
  /sgtier             get_backend1
  /sto                get_backend2
  </code></pre>
  <p>Config file</p>
  <pre><code>vcl 4.0;
  import directors;
  
  
  backend sg_gw1 {
      .host = &quot;1.8.4.4&quot;;
      .port = &quot;1043&quot;;
  }
  
  backend tss_gw1 {
      .host = &quot;1.8.13.2&quot;;
      .port = &quot;8080&quot;;
  }
  
  
  sub vcl_recv {
      if (req.url ~ &quot;sto&quot;) {
         set req.backend_hint = sg_gw1;
      }
      elsif (req.url ~ &quot;common&quot;) {
          set req.backend_hint = tss_gw1;
      }
  }
  </code></pre>