We have a server which needs to serve multiple domains though varnish e.g. example1.com, example2.com and example3.com
Our current .vcl file looks like this:
unable to add comment so here we go
slight modification for varnish 4
#for www.example.com or example.com
if (req.http.host ~ "^(www\.)?example\.com$") {
set req.backend_hint = example_com;
return (lookup);
}
#with any subdomain support
if (req.http.host ~ "^(.*\.)?example2\.com$") {
set req.backend_hint = example2_com;
return (lookup);
}
replace backend with backend_hint