Stupid has a stupid fetch- problem

Harri.Paivaniemi at tieto.com Harri.Paivaniemi at tieto.com
Mon Oct 10 12:10:02 CEST 2011


Hi,

I'm just so stupid with this.

Can somebody see, why on the earth with this vcl_fetch EVERY request goes righ into the last configured apache_farm?

If I test this with correct url's, I can't get any traffic to match to this:

"^/easearch/json/something/") {

or this:

} elseif (req.url ~ "^/easearch") {

... and all goes, no matter what I ask, to this:

} elseif (req.url ~ "^/bar/.*\.(gif|jpg|jpeg|png|bmp|htm|html|xml|css|js|swf|flv)$") {

... and to apache_farm, like it was te default or something.

How come?

Thanks.

--------------------------------


sub vcl_fetch {

#1. www.foo.fi and foo.fi vhosts

if ((req.http.Host ~ "www\.foo.fi") || req.http.Host ~ "foo\.fi") {

#Set default site header
set req.http.Host = "foo.fi";

#easearch rules

#check error status first

if (beresp.status > 399) {
#no cache if status is 400 or bigger
set beresp.ttl = 0s;
return (hit_for_pass);
}

if (req.url ~ "^/easearch/json/something/") {
set beresp.ttl = 60m;
remove beresp.http.Server;
set req.backend = tom_jerry_8080;
unset beresp.http.set-cookie;
set beresp.grace = 300s;
return (deliver);

} elseif (req.url ~ "^/easearch") {
set beresp.ttl = 10m;
remove beresp.http.Server;
set req.backend = tom_jerry_8080;
unset beresp.http.set-cookie;
set beresp.grace = 300s;
return (deliver);

} elseif (req.url ~ "^/bar/.*\.(gif|jpg|jpeg|png|bmp|htm|html|xml|css|js|swf|flv)$") {
set req.backend = apache_farm_80;
unset beresp.http.set-cookie;
set beresp.ttl = 3m;
set beresp.grace = 300s;
return (deliver);
 
} else {
#no rules anymore for foo.fi vhost
error 200 "No rules configured for vhost foo.fi...";
}

} else {
#this was the last vhost congifured in this instance...
error 200 "Not permitted";

}
}





More information about the varnish-misc mailing list