清漆不识别req.hash

我在Redhat上使用了Varnish 3.0.2,在添加了vcl_hash部分之后,服务清漆开始失败。 我做了清漆,然后使用vcl.load加载vcl

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 

猫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); } 

什么可能是错的?

    直接引用https://www.varnish-cache.org/docs/3.0/installation/upgrade.html#req-hash-is-replaced-with-hash-data

    在Varnish 3.x中, req.hash被replace为hash_data

    你不再追加到+ =的散列,所以:

     set req.hash += req.url; 

     hash_data(req.url);