Welcome! Log In Create A New Profile

Advanced

"map $url" does not work instead of "if $url"

Posted by nginxx 
"map $url" does not work instead of "if $url"
August 07, 2014 10:34AM
This configuration works:

if ($uri ~ "/(apple|banana|orange)/") {
set $nocache 1;
}

However this does not work:

map $uri $nocache {
default 0;
~^/(apple|banana|orange)/ 1;
}

I prefer using map for performance reasons, furthermore "if is evil". Would you point me to the right direction to improve the map statement?
Re: "map $url" does not work instead of "if $url"
October 02, 2014 09:48PM
This used to work in 1.3.13+ but for some reason no longer works on 1.6.0 or 1.6.1.

Can someone please explain what has changed concerning the map directive that makes it no longer work as it did in the past?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 137
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready