Weird "^" in the regex of varnish

Junxian Yan junxian.yan at gmail.com
Mon Mar 7 16:56:09 CET 2011


Hi Guys

I encountered this issue in two different environment(env1 and env2).
The sample code is like:
in vcl_fetch()

  else if (req.url ~ "^/tables/\w{6}/summary.js") {
    if (req.http.Set-Cookie !~ " u=\w") {
      unset beresp.http.Set-Cookie;
      set beresp.ttl = 2h;
      set beresp.grace = 22h;
      return(deliver);
    } else {
      return(pass);
    }
  }

In env1, the request like
http://mytest.com/api/v2/tables/vyulrh/read.jsamlcan enter lookup and
then enter fetch to create a new cache entry. Next
time, the same request will hit cache and do not do fetch anymore
In env2, the same request enter and go into vcl_fetch, the regex will fail
and can not enter deliver, so the resp will be sent to end user without
cache creating.

I'm not sure if there is somebody has the same issue. Is it platform related
?


R
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20110307/1e0d32cc/attachment-0003.html>


More information about the varnish-misc mailing list