Using map module variable being unset with if

kamlou nginx-forum at
Wed Jun 22 09:06:20 MSD 2011

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.

Thanks and any help is much appreciated.


Posted at Nginx Forum:,208914,208914#msg-208914

More information about the nginx mailing list