varnish forward to wrong backend

Crowder, Travis Travis.Crowder at penton.com
Fri Aug 16 00:35:40 CEST 2013


It is probably that the other domains have the same URL.  Check for www.mydns1.com<http://www.mydns1.com> in your first conditional.

-Travis Crowder

Sent from my iPhone

On Aug 15, 2013, at 5:20 PM, "Lei Wang" <leiwang at rhapsody.com<mailto:leiwang at rhapsody.com>> wrote:

Hi James,

It is very simple like below:
sub vcl_recv {
  if (req.url ~ "^/my-home") {
    set req.http.host = "www.mydns1.com<http://www.mydns1.com>";
    set req.backend = backend1 ;
  } elsif (req.http.host ~ "^www.mydns2.com<http://www.mydns2.com>") {
    set req.http.host = "www.mydns2.com<http://www.mydns2.com>";
    set req.backend = backend2
  } elsif (req.http.host ~ "^www.mydns3.com<http://www.mydns3.com>") {
    unset req.http.Accept;
    set req.backend = backend3;
  } elsif (req.http.host ~ "^www.mydns4.com<http://www.mydns4.com>") {
    unset req.http.Accept;
    set req.backend = backend4;
  } else {
    error 404 "Unknown virtual host";
  }
}


Thanks,

Lei


On Thu, Aug 15, 2013 at 2:12 PM, James Pearson <james at ifixit.com<mailto:james at ifixit.com>> wrote:
Excerpts from Lei Wang's message of 2013-08-15 11:09:13 -0700:
> I have varnish 3 (varnish-3.0.4 revision 9f83e8f) installed to cache
> multi-site in one configuration. Sometimes Varnish switched to use the
> first backend in the configuration for all the requests to the other sites.
> As in the sample configuration below, the request to backend2, backend3,
> backend4 sometimes forwarded to backend1. Does anyone have the same problem
> or know any solution, suggestion?
>
> The varnish backend configuration is quite simple like below:
>
> [snip]

What does the rest of your config look like, specifically the part that assigns
a backend?
 - P

_______________________________________________
varnish-misc mailing list
varnish-misc at varnish-cache.org<mailto:varnish-misc at varnish-cache.org>
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

_______________________________________________
varnish-misc mailing list
varnish-misc at varnish-cache.org<mailto:varnish-misc at varnish-cache.org>
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20130815/56aa3823/attachment.html>


More information about the varnish-misc mailing list