Reputation: 43
I am checking some IF condition (inside server directive), if it is passed then check other IF condition and if it is also passed then return some test. My code is as follows
if ($a != "Tree") {
if ($a != "Plant") { return 403 "It is not tree or plant";
}
}
When I am using this code I am getting error for second IF as "if" directive is not allowed here.
Upvotes: 2
Views: 5188
Reputation: 1341
If you need to check multiple conditions you can use this
In your case it would be:
if ($a != "Tree") {
set $test no-tree;
}
if ($a != "Plant") {
set $test "${test}+no-plant";
}
if ($test = no-tree+no-plant) {
return 403 "It is not tree or plant";
}
But I wouldn't recommend using it unless its really necessary.
Upvotes: 3