Complex Backend Selection through VCL?
T. Pascal
t_pascal at zennet.com
Wed Aug 11 20:46:08 CEST 2010
>Would someone here help me with using VCL for a complex situation with
>Varnish?
>
>sub vcl_fetch {
> if (beresp.status == 302) {
> if (beresp.http.location ~ "(.*s01.*)" ) {
> set req.backend = b1;
> set req.url = beresp.http.location;
> set req.http.host = "s01.a.com";
> }
> else if (beresp.http.location ~ "(.*s02.*)" ) {
> set req.backend = b2;
> set req.url = beresp.http.location;
> set req.http.host = "s02.com";
> }
> }
>
> restart;
>}
>
I think your "restart" is in too broad a scope (vcl_fetch is
restarting on each request?)
sub vcl_fetch {
if (beresp.status == 302) {
if (beresp.http.location ~ "(.*s01.*)" ) {
set req.backend = b1;
set req.url = beresp.http.location;
set req.http.host = "s01.a.com";
}
else if (beresp.http.location ~ "(.*s02.*)" ) {
set req.backend = b2;
set req.url = beresp.http.location;
set req.http.host = "s02.com";
}
restart;
}
}
-T.
More information about the varnish-dev
mailing list