Varnish 3 VCL regex

I have been struggling to match this url pattern in varnish 3 vcl

www.example.com/alpha/76/Permanent/

if ((req.url ~ "/*/*/Permanent/$")) {
   set beresp.http.Cache-Control = "public, max-age=1400, s-maxage=1400";
   set beresp.ttl = 30m;
   return(deliver);
}

but it seems not to match the condition. Any idea where I am wrong?

Upvotes: 1

Views: 555

Answers (1)

Kobi
Kobi

Reputation: 138017

/* means zero or more slashes (this is not glob). You should use:

^/\w+/\w+/Permanent/$

\w+ would match one or more alphanumeric characters.

Source: VCL Regex cheat-sheet - Matching with wildcards

Upvotes: 1

Related Questions