Multiple backends on same server (cPanel)

Jerry Steele ticktockhouse at
Fri Mar 21 11:07:02 CET 2014


I seem to be having somewhat confusing issues with Varnish. I've got a
simple setup (as I haven't been using it that long, I haven't really
got into anything more complex).

backend default {
  .host = "";
  .port = "8081";

backend default2 {
  .host = "";
  .port = "8081";

## Multiple virtual hosts
sub vcl_recv {
if ( ~ "^[0-9]+)?$";) {
      set req.backend = default;

elsif ( ~ "^[0-9]+)?$";) {
      set req.backend = default;
elsif ( ~ "^[0-9]+)?$";) {
      set req.backend = default2;

Now, this seems to work well for, (plus
subdomains - I'm not sure why this should be, as the regexes have the
^ anchor tag ?). The problem is, that this doesn't seem to work for, which is pointing to a different backend. Well, actually
it does work, in that it ends up at the server's default page (it's a
cPanel machine), rather than timing out. Fear not, I'm more command
line than a panel user :)

I've checked the virtualhosts are correct, and indeed the site is
visible at

I initially had a problem with working, and going to the default page, which is why I've been
making changes.

Obviously, IPs and domain names have been changed to protect the innocent..

Does anyone have any ideas?



Jerry Steele
Telephone: +44 (0)7920 237105

More information about the varnish-misc mailing list