Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 = "";
  .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 +=;
  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;

What could be wrong?

share|improve this question
up vote 7 down vote accepted

Direct quote from

In Varnish 3.x, req.hash is replaced with hash_data.

You no longer append to the hash with +=, so:

set req.hash += req.url;


share|improve this answer
Thanks, Pothi.. Such a noob I am for not noticing that. – et3 Oct 25 '13 at 10:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.