Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to convert a part of code from the older 2.1.5 to version 3.0.3 Having trouble with vcl_hash where syntax has changed.

Syntax from 2.1.5

sub identify_cookie {
  if (req.http.cookie ~ "cookie_city_id=") {
    set req.http.X-Cookie = regsub(req.http.cookie, ".*cookie_city_id=([^;]+);.*", "\1");
   }
}

vcl_recv {
  call identify_cookie;
  ....
}

vcl_hash {
  if(req.http.host ~ "(^beta.bolly.in)"){
    set req.hash += req.url;
    set req.hash += req.http.X-Cookie;
    set req.hash += req.http.host;
    return(hash);
  }
}

How do I set the above in version 3.0.3? I have tried the following under vcl_hash

vcl_hash {
if (req.http.host ~ "^beta.bolly.in"){
    hash_data(req.url);
    hash_data(req.http.X-Cookie);
    hash_data(req.http.host);
    return(hash);
}

The request always goes to backend. How do I sort this issue? I am not sure if the hash is being set

share|improve this question
add comment

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.