Request for a "no capture" rewrite directive enhancement
Peter Mescalchin
peter.mescalchin at gmail.com
Thu May 29 02:09:41 UTC 2014
Fantastic Igor - I didn't know that you could do named captures in Nginx -
good to know.
That solves it rather nicely.
And thanks B.R. - yep, that syntax is part of PCRE.
Pete
> I think Igor is suggesting PERL named captures.
>
> Although, it appears to me the correct syntax would rather be
(?<name>...),
> as perlre docs <http://perldoc.perl.org/perlre.html#Extended-Patterns
>state.
> Then, just use you first syntax (omitting the 'set' directives).
> ---
> *B. R.*
>
>
> On Wed, May 28, 2014 at 12:02 PM, Igor Sysoev <igor at sysoev.ru> wrote:
>
> > On 28 May 2014, at 08:55, Peter Mescalchin <peter.mescalchin at
gmail.com>
> > wrote:
> >
> > Thanks Igor,
> >
> > I had explored that method already, sadly (as you know) "alias" is
> > given as an absolute path meaning I can't use this block of config
within
> > multiple virtual hosts which I include; - would have to re-write this
same
> > block of config for each Virtual host modifying the alias path prefix.
> >
> > And since alias man page explicitly states that $document_root can't be
> > used it's not possible to complete this config in a reusable way. (e.g.
> > alias $document_root/path/to/$1/$2; would be perfect).
> >
> > Alas, I think what I have (storing the captures in temp vars) is the
only
> > real solution thus far.
> >
> > Unless the penny hasn't dropped in my head? :)
> >
> >
> > Then you can set these variable directly in regex:
> > location ~
"^/[a-f0-9]{16}/(<?resource_type>css|js)/(<?resource_path>.+)” {
> >
> >
> > --
> > Igor Sysoev
> > http://nginx.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20140529/14527bc0/attachment.html>
More information about the nginx
mailing list