This is What I have
http://example.com ---> https://www.example.com ---> https://example.com
This is what I am trying to Achieve
http://example.com ---> https://example.com
My current nginx config has the below mentioned line
if ($real_scheme = 'http') { return 301 https://$host$request_uri; }
Where real_scheme is a variable derived from a Map block
I am trying to Achieve the same using a Map, can anyone lemme know the mistake I am making, Below is the updated Config
map $host $nonwwwhost {
~*^www\.(.*) $1;
default $host;
}
if ($real_scheme = 'http') { return 301 https://$nonwwwhost$request_uri; }