Multiple backends on same server (cPanel)

MAGNIEN, Thierry thierry.magnien at
Fri Mar 21 11:19:30 CET 2014


I would say that none of your regex works and you always end up using the default backend. That why you think it works for domain1 and domain2.


-----Message d'origine-----
De : at [ at] De la part de Jerry Steele
Envoyé : vendredi 21 mars 2014 11:07
À : varnish-misc at
Objet : Multiple backends on same server (cPanel)


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

varnish-misc mailing list
varnish-misc at

More information about the varnish-misc mailing list