Varnish does not recognize req.hash
Posted
by
Yogesh
on Server Fault
See other posts from Server Fault
or by Yogesh
Published on 2013-10-25T08:18:39Z
Indexed on
2013/10/25
9:57 UTC
Read the original article
Hit count: 401
I have Varnish 3.0.2 on Redhat and service varnish start fails after I added vcl_hash section. I did varnishd and then loaded the vcl using vcl.load
vcl.load default default.vcl
Message from VCC-compiler:
Unknown variable 'req.hash'
At: ('input' Line 24 Pos 9)
set req.hash += req.url;
--------########------------
Running VCC-compiler failed, exit 1
cat default.vcl
backend default {
.host = "127.0.0.1";
.port = "8080";
}
sub vcl_recv {
if( req.url ~ "\.(css|js|jpg|jpeg|png|swf|ico|gif|jsp)$" ) {
unset req.http.cookie;
}
}
sub vcl_hash {
set req.hash += req.url;
set req.hash += req.http.host;
if( req.httpCookie == "JSESSIONID" ) {
set req.http.X-Varnish-Hashed-On = regsub( req.http.Cookie, "^.*?JSESSIONID=([a-zA-z0-9]{32}\.[a-zA-Z0-9]+)([\s$\n])*.*?$", "\1" );
set req.hash += req.http.X-Varnish-Hashed-On;
}
return(hash);
}
What could be wrong?
© Server Fault or respective owner