On Fri, Mar 21, 2014 at 11:19 AM, MAGNIEN, Thierry
<[email protected]> wrote:
> Hi,
>
> 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.

One way to easily check that is to swap the backend declarations:

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

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

[...]

Cheers,
Dridi

> Regards,
> Thierry
>
> -----Message d'origine-----
> De : [email protected] 
> [mailto:[email protected]] De la 
> part de Jerry Steele
> Envoyé : vendredi 21 mars 2014 11:07
> À : [email protected]
> Objet : Multiple backends on same server (cPanel)
>
> Hello,
>
> 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 = "11.22.33.208";
>   .port = "8081";
> }
>
> backend default2 {
>   .host = "11.22.33.210";
>   .port = "8081";
> }
>
>
> ## Multiple virtual hosts
> sub vcl_recv {
> if (req.http.host ~ "^domain1.com(:[0-9]+)?$";) {
>       set req.backend = default;
> }
>
> elsif (req.http.host ~ "^domain2.co.uk(:[0-9]+)?$";) {
>       set req.backend = default;
> }
> elsif (req.http.host ~ "^domain3.com(:[0-9]+)?$";) {
>       set req.backend = default2;
> }
>
> Now, this seems to work well for domain1.com, domain2.co.uk (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
> domain3.com, 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 domain3.com:8081
>
> I initially had a problem with domain3.com working, and
> www.domain3.com 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?
>
> Thanks
>
> --
> ---
>
> Jerry Steele
> Telephone: +44 (0)7920 237105
> http://ticktockhouse.co.uk
>
> _______________________________________________
> varnish-misc mailing list
> [email protected]
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
> _______________________________________________
> varnish-misc mailing list
> [email protected]
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

_______________________________________________
varnish-misc mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

Reply via email to