Weird "^" in the regex of varnish

Junxian Yan junxian.yan at gmail.com
Tue Mar 8 06:22:13 CET 2011


I upgraded varnish to 2.1.5 and used log function to trace the req.url and
found there was host name in 'req.url'. But I didn't find any more
description about this format in wiki.
So I have to do a regsub before entering every function.  Dose it make
sense?

Below is varnish log,

    0 CLI          - Rd ping
    0 CLI          - Wr 200 19 PONG 1299561539 1.0
   12 SessionOpen  c 10.0.2.130 56799 :6081
   12 ReqStart     c 10.0.2.130 56799 1589705637
   12 RxRequest    c GET
   12 RxURL        c
http://staging.test.com/purge/tables/vyulrh/summary.js?grid_state_id=3815


On Mon, Mar 7, 2011 at 7:56 AM, Junxian Yan <junxian.yan at gmail.com> wrote:

> 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.jsaml can 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/2e3fe698/attachment-0003.html>


More information about the varnish-misc mailing list