Varnish multiple backend configuration?
Nathan McSween
nwmcsween at gmail.com
Wed Jun 6 07:19:54 CEST 2007
Would this work as a simple load balancer configuration?
backend apache {
set backend.host = ""; set backend.port = "80";
}
backend nginx {
set backend.host = ""; set backend.port = "80";
}
sub vcl_recv {
if (req.request != "GET" && req.request != "HEAD") {
pipe;
} if (req.http.Expect) {
pipe;
} if (req.http.Authenticate || req.http.Cookie) {
pass;
} lookup;
}
sub vcl_pipe {
pipe;
}
sub vcl_pipe {
pipe;
}
sub vcl_pass {
pass;
}
sub vcl_hash {
hash;
}
sub vcl_hit {
if (!obj.cacheable) {
pass;
} deliver;
}
sub vcl_miss {
if (req.url ~ "/.(php|py)$") {
set req.backend = apache; fetch;
}
else (req.url ~ "/.(*)$") {
set req.backend = nginx; fetch;
}
}
sub vcl_fetch {
if (!obj.valid) {
error;
} if (!obj.cacheable) {
pass;
} if (resp.http.Set-Cookie) {
pass;
} insert;
}
sub vcl_timeout {
discard;
}
More information about the varnish-misc
mailing list