Two Different Backends
varnish at mm.quex.org
Tue Mar 22 10:54:17 CET 2011
On Tue, Mar 22, 2011 at 10:42:54AM +0100, Stefan Welschhoff wrote:
> I want to configure varnish with two different backends. But with
> my configuration varnish can't handle with both.
There is a logic error here:
> if (req.url ~"^/partner/")
> set req.backend = directory1;
> set req.http.host = "partnerservicesq00.xxx.de";
The above if-clause will be run, and then, regardless of the
outcome, the next if-else-clause will be run:
> if (req.url ~"^/schaden/")
> set req.backend = directory2;
> set req.http.host = "servicesq00.xxx.de";
> set req.backend = default;
This means that if the URL matched /partner/ the backend will get
set to back to default, because it falls through to the "else".
I think you want your second if for /schaden/ to be an elsif.
if (req.url ~ "^/partner/")
elsif (req.url ~ "^/schaden/")
If that's not the problem you're having, please provide some more
information, i.e. backend configuration and error messages if any,
or the expected and actual result.
More information about the varnish-misc