map $uri in 1.3.0+ NOT working in 1.6.0+

nikolaos2012 nginx-forum at
Sat Oct 4 04:20:25 UTC 2014

Hi Valentin,

I am not sure that what you provided is exactly what I am trying to

What I want is if someone hits port 80 (HTTP) with /account that they
redirect to /account on port 443 (HTTPS).  However, if they come in on port
443 (HTTPS) with /account that they remain on port 443 (HTTPS).  Similar
rules exist for keeping certain URI's on HTTP or allowing certain URIs to
use HTTP/HTTPS (basically we don't care).

With the example you provided I would need to embed these location
directives into the respective Server sections of our main template file
(unless I am missing something) and thus would introduce domain /
application specific behaviour into the template VS. how we are doing it now
in that application specific behaviour is limited to pre-pended or
post-pended include files so as to create clean separation across multiple

While the map directive may not be the most efficient it has the benefits of
being the most compact, easiest to maintain and that it can be decoupled
from our core common Nginx template files i.e. it can live outside the
Server directive.  So at this point its a tradeoff between simplicity and

Just how bad will the map (say about a dozen mappings) perform in comparison
to location directives?

Posted at Nginx Forum:,253733,253764#msg-253764

More information about the nginx mailing list