Primarily just to make the code cleaner and a little concerned if I have a lot of hostnames. 100 for example. Having to potentially traverse several if statements for each request seems inefficient to me.
Thank you, Paul On Mon, Mar 7, 2011 at 11:32 PM, Indranil Chakravorty < [email protected]> wrote: > 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. > > Thanks, > Neel > > On Tue, 08 Mar 2011 12:31:11 +0530 Paul Lu <[email protected]> wrote > > >Hi, > > > >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? > > > >example pseudo code: > >================================= > >vcl_recv(){ > > > > if(req.http.host == "www.domain1.com") > > { > > set req.backend = www_domain1_com; > > # more code > > return(lookup); > > } > > if(req.http.host == "www.domain2.com") > > { > > set req.backend = www_domain2_com; > > # more code > > return(lookup); > > } > > if(req.http.host == "www.domain3.com") > > { > > set req.backend = www_domain3_com; > > # more code > > return(lookup); > > } > >} > >================================= > > > >Thank you, > >Paul > > _______________________________________________ > > varnish-misc mailing list > > [email protected] > > http://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
_______________________________________________ varnish-misc mailing list [email protected] http://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
