Virtual hosting in Varnish with individual vcl files for configuration

Posted by Michael Sørensen on Server Fault See other posts from Server Fault or by Michael Sørensen
Published on 2012-06-25T08:55:53Z Indexed on 2012/06/25 9:17 UTC
Read the original article Hit count: 255

I wish to use varnish to put in front of an apache and a tomcat on the same server. Depending on the ip requested, it goes to a different backend. This works.

Now for most of the sites the default varnish logic will work just fine. However for some specific sites I wish to use custom VCL code.

I can test for host name and include config files for the specific domains, but this only works inside the individual methods recv etc.

Is there a way to include a complete set of instructions, in one file, per domain, without having to manage separate files for subdomain_recv, subdomain_fetch etc? And preferably without running seperate instances of varnish.

When I try to include a file on the "root level" of default.vcl, I get a compilation error.

Best regards, Michael

© Server Fault or respective owner

Related posts about configuration

Related posts about virtualhost