map $uri in 1.3.0+ NOT working in 1.6.0+

Valentin V. Bartenev vbart at
Fri Oct 3 18:57:58 UTC 2014

On Friday 03 October 2014 12:43:29 nikolaos2012 wrote:
> Hi Valentin,
> I have read that I should be using the location directive unless I have
> numerous mappings in other places.
> In this case we have about a dozen mappings.
> But I am curious if I used the location directive what would the above
> mapping example translate to so that it results in a $use_secure variable
> that we can include in another file so that it can be used inside multiple
> server blocks.

If I understand you case right, then it can be something like that:

  location /sites/ {
      return 301 https://secure$host$request_uri;

  location /account/ {
      return 301 https://secure$host$request_uri;

  wbr, Valentin V. Bartenev

More information about the nginx mailing list