Welcome! Log In Create A New Profile

Advanced

Re: Using map module variable being unset with if

Maxim Dounin
June 22, 2011 04:50AM
Hello!

On Wed, Jun 22, 2011 at 01:06:20AM -0400, kamlou wrote:

> Hey guys,
>
> I have been trying to use the nginx map module to do some rewrites in
> bulk, basically my
> map looks something like this:
>
> map $request_body $var {
> default no;
> ~.+.string1 dorw;
> ~.+.string2 dorw;
> ...
> }
>
> in a location i have the following
>
> if ($var = dorw){
> rewrite ^ /home last;
> }
>
> I also have a log_format which logs the variable state (and it reports
> correct), however
> once I enable that if.. the $var seems to reset to 'no'.
>
> Any ideas? This is kind of confusing.

$request_body isn't available unless it's read, and this happens
after rewrite phase where "if" is executed. Therefore testing
$var with "if" will always result in "no" and this result will be
cached for further use.

Maxim Dounin

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Using map module variable being unset with if

kamlou June 22, 2011 01:06AM

Re: Using map module variable being unset with if

Maxim Dounin June 22, 2011 04:50AM

Re: Using map module variable being unset with if

kamlou June 22, 2011 10:35AM

Re: Using map module variable being unset with if

kamlou June 22, 2011 10:51AM

Re: Using map module variable being unset with if

António P. P. Almeida June 22, 2011 10:58AM

Re: Using map module variable being unset with if

Mikhail Mazursky June 22, 2011 11:34PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 274
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