Apart from improving the construct to if ... elseif , could you please tell me the reason why you are looking for a different way? Is it only for ease of writing less statements or is there some other reason you foresee? I am asking because we also have a number of similar construct in our vcl. Thanks.<br><br>Thanks,<br>Neel<br><!-- Message id:AANLkTiknkaOiLej7Rk9R0isF7NaASYs0z_cqnw+PvBGL --><br>
On Tue, 08 Mar 2011 12:31:11 +0530 Paul Lu <paul.lu81@gmail.com> wrote<br>
>Hi,<br>
><br>
>I have to work with a lot of domain names in my varnish config and I was wondering if there is an easier to way to match the hostname other than a series of if statements. Is there anything like a hash? Or does anybody have any C code to do this?<br>
> <br>
>example pseudo code:<br>
>=================================<br>
>vcl_recv(){<br>
><br>
> if(req.http.host == "www.domain1.com")<br>
> {<br>
> set req.backend = www_domain1_com;<br>
>  # more code<br>
> return(lookup);<br>
> }<br>
> if(req.http.host == "www.domain2.com")<br>
> {<br>
> set req.backend = www_domain2_com;<br>
> # more code<br>
>  return(lookup);<br>
> }<br>
> if(req.http.host == "www.domain3.com")<br>
> {<br>
> set req.backend = www_domain3_com;<br>
> # more code<br>
> return(lookup);<br>
>  }<br>
>}<br>
>=================================<br>
><br>
>Thank you,<br>
>Paul<br>
> _______________________________________________<br>
> varnish-misc mailing list<br>
> varnish-misc@varnish-cache.org<br>
> http://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc