Welcome! Log In Create A New Profile

Advanced

map $uri in 1.3.0+ NOT working in 1.6.0+

Posted by nikolaos2012 
map $uri in 1.3.0+ NOT working in 1.6.0+
October 02, 2014 10:28PM
We have the following code that worked in 1.3.16....


# Map VWS URI's to HTTP ($use_secure=0), HTTPS ($use_secure=1) or keep same ($use_secure=2)
map $uri $use_secure {
default 0;
~^/sites/ 2;
~^/account/ 1;
}


And this file for the main config that includes the map file:

include /srv/etc/web_x/nginx/include/example.org_prepend.conf;

server {
listen 192.168.0.101:80;
server_name p3.example.com;

# If map says that this resource should be served over HTTPS (vs. HTTP) then redirect now
if ($use_secure = 1) {
return 301 https://securep3.example.com$request_uri;
}
}


However in 1.6.0 and 1.6.1 $use_secure is ALWAYS 0 no matter what URI is used.

I have even tried using $request_uri instead of $uri and it still won't work.

Why is this not backward compatible OR what am I doing wrong?
Re: map $uri in 1.3.0+ NOT working in 1.6.0+
October 02, 2014 11:08PM
I just realized I posted this in the wrong forum... re-posting in the Nginx Mailing List - English....
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 136
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