Welcome! Log In Create A New Profile

Advanced

Re: if-clause garbles variable content

December 20, 2009 01:22AM
Maxim Dounin Wrote:
-------------------------------------------------------

> This is somewhat expected, as you trashed captures
> from location by executing another regex.
>
> You should either use named captures as supported
> in nginx 0.8.25+, like this:
>
> location ~* ^/aabbccddeeff(?/.*) {
> ...
> alias /tmp/test/aabbccddeeff$file;
> }

Now that you're mentioning the captures, it all makes sense.
I'd consider this a last resort solution, as running the current stable build is definitely a plus.


> or save capture results before executing another
> regexp, e.g.
>
> location ~* ^/aabbccddeeff(/.*) {
> set $file $1;
> ...
> alias /tmp/test/aabbccddeeff$file;
> }

I already tried that way, but the configuration doesn't validate:
the "alias" directive must use captures inside location given by regular expression in


> And this one isn't expected, but seems to be just another chapter
> in "if is evil" saga. In this particular case alias directive
> isn't correctly inherited into implicit location created by if(),
> and this screws things up.

For legacy reasons, the first directory could be all uppercase or all lowsercase. Avoiding the initial capture through $uri does the job.

Thank you for your help.
Subject Author Posted

if-clause garbles variable content

marius December 19, 2009 03:33PM

Re: if-clause garbles variable content

Maxim Dounin December 19, 2009 05:02PM

Re: if-clause garbles variable content

marius December 20, 2009 01:22AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 277
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready