Map within a map

Can I use multiple maps with a single map ?

For example;

map $ngxvar1 $myvar1 {
default 0;
~*string 1;
}
map $ngxvar2 $myvar2 {
default 0;
~*string 1;
}
map $ngxvar3 $myvar3 {
default 0;
~*string 1;
$myvar1 1;
$myvar2 1;
}

This way I would only have one IF $myvar3 …, but obviously this
example
doesn’t work, is this possible ?

Posted at Nginx Forum:

On 23 Oct 2014, at 21:17, itpp2012 [email protected] wrote:

~*string 1;
}
map $ngxvar3 $myvar3 {
default 0;
~*string 1;
$myvar1 1;
$myvar2 1;
}

This way I would only have one IF $myvar3 …, but obviously this example
doesn’t work, is this possible ?

You can try other path:

map $ngxvar1 $myvar1 {
default $myvar2;
~*string 1;
}

map $ngxvar2 $myvar2 {
default 0;
~*string 1;
}


Igor S.

Igor S. Wrote:

~*string 1;
}

tnx Igor, this works to:

map $ngxvar1 $myvar1 {
default 0;
~*string 1;
}
map $ngxvar2 $myvar2 {
default 0;
~*string 1;
}

map $myvar1$myvar2 $result1 {
default 0;
~1 1;
}

if ($result1) { return 403; }

Posted at Nginx Forum: