A lot of if statements to handle hostnames
Paul Lu
paul.lu81 at gmail.com
Mon Mar 7 21:37:49 CET 2011
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20110307/061aa29e/attachment-0003.html>
More information about the varnish-misc
mailing list