varnish 5 and multiple domains

Admin Beckspaced admin at beckspaced.com
Wed Oct 26 10:03:50 CEST 2016


dear varnish users ;)

i'm new to varnish and got a question about how to best implement 
multiple domains into varnish 5

i got quite a few domains hosted on my linux server and would like to 
include some domains, exclude others and also switch between different 
vcl's based on the domain.

i've looked around on the internet but thought why not ask the mailing 
list pro's for advice ;)

should i use the new load and label feature with version 5 as explained 
here:

https://varnish-cache.org/docs/trunk/users-guide/vcl-separate.html

or should i use the include feature as explained here:

https://www.varnish-cache.org/lists/pipermail/varnish-misc/2011-January/019815.html

e.g.

        if (req.http.Host == "domainx.be") {
            include "/etc/varnish/domainx.be.vcl";
        }

or, instead of include, should i put all in a single vcl file?

sub vcl_recv {

if (req.http.Host == "www.example.nl")
  {
    do some stuff;
  }
  elsif (req.http.Host == "www.example.com")
  {
    do some stuff;
  }

}

which approach would you recommend for multiple domains?

thanks for your hints & tips ;)
becki



More information about the varnish-misc mailing list