varnish regex

Vitaly Burshteyn vburshteyn at broadway.com
Wed Nov 10 18:23:23 CET 2010


Sorry 

I somehow forgot the NOT part.

I need it not to cache that url.

Vitaly Burshteyn
Senior Network Engineer
Broadway.com, Theatre Direct International
729  7th Avenue
New York, New York 10019
Phone: 212.817.9117
Cell# 917-701-5732


-----Original Message-----
From: Michael Loftis [mailto:mloftis at wgops.com] 
Sent: Wednesday, November 10, 2010 12:21 PM
To: Vitaly Burshteyn
Cc: varnish-misc
Subject: Re: varnish regex

On Wed, Nov 10, 2010 at 9:56 AM, Vitaly Burshteyn
<vburshteyn at broadway.com> wrote:
> Hi folks,
>
>
>
> I have a set of url's that I need to make sure that varnish does cache.  The
> url patern looks like this:
>
>
>
> Siteurl/r/anynumber
>
>
>
> if (req.url ~ "/r/*/") {
>
>         return(pass);
>
>     }
>
>
>
>
>
> Or
>
>
>
>
>
> if (req.url ~ "^/r/\d+/$") {
>
>         return(pass);
>
>     }
>
>
>
>
>
> Sorry about this question, but I am not sure how varnish processes regex
> values.


First, return (lookup) not pass.  Lookup pushes it into the cache
hash/lookup routine for a fetch/hit.  Secondly if there's no trailing
/ in your requested URLs, then make sure it doesn't appear in your
pattern either.  The regular expression flavor is PCRE/libpcre.

Even if you return lookup you're not guarenteed to cache.  POSTs,
things with cookies don't get cached.
http://www.varnish-cache.org/docs/2.1/reference/vcl.html for VCL
reference and the default VCL.

____________________________________
The information contained in this transmission may contain privileged 
and confidential information.  It is intended only for the use of the 
person(s) named above. If you are not the intended recipient,  you are 
hereby notified that any review, dissemination, distribution or 
duplication of this communication is strictly prohibited. If you are 
not the intended recipient, please contact the sender by reply email 
and destroy all copies of the original message.




More information about the varnish-misc mailing list