I am using NGINX for 301 redirects on Ubuntu and reverse proxy for my Web Application and aim is to redirect traffic to non-www url such as https://mywebapplication.com. 
So with my current config for NGINX Conf File:
mywebapplication.com -> https://mywebapplication.com
www.mywebapplication.com -> https://mywebapplication.com
http://mywebapplication.com -> https://mywebapplication.com
http://www.mywebapplication.com -> https://mywebapplication.com
123.456.789.123 -> https://mywebapplication.com
http://123.456.789.123 -> https://mywebapplication.com
Works fine but when IP with HTTPS is provided in the URL, I get "Your connection is not private."
https://123.456.789.123 -> Your connection is not private
Here's my NGINX Conf.
server {
    listen 123.456.789.123:80;
    location / {
        proxy_pass "http://localhost:4000/";
        proxy_http_version 1.1;
        proxy_set_header Connection "Keep-Alive";
        proxy_set_header Proxy-Connection "Keep-Alive";
    }
}
server {
    listen 123.456.789.123:80;
    server_name  123.456.789.123 123.456.789.123:4000;
    return       301 https://mywebapplication.com$request_uri;
}
server {
    listen 80 http2;
    listen [::]:80 http2;
    server_name  mywebapplication.com www.mywebapplication.com;
    return       301 https://mywebapplication.com$request_uri;
}
server {
    listen       443 ssl http2;
    server_name  www.mywebapplication.com;
    return       301 https://mywebapplication.com$request_uri;
}
server {
    listen 443 ssl http2 default_server;
    listen [::]:443 ssl http2 default_server;
    server_name mywebapplication.com;
    ...
    ...
    ...
    ...
}
How can I handle IP with HTTPS to a successful 301 redirection?
Thanking you guys!
 
    