Nginx enforces https (automatic jump from http to https)
Nginx returns 400 for sites with https enabled for http access. the web site entered by the browser is http by default, and it is annoying to change the URL to https every time. Therefore, the method of automatic jump is considered. The $ scheme variable is used to judge whether the URL is redirected if it is not https. Invalid.
After searching, a large copy on the Internet all said rewrite (. *) https: // $ host/$1 permanent; yes. If you do not consider the port number, it is not very reliable. I tried it.
After thinking about it, it should be because an exception was identified at the beginning and there was no reason to go back.
Find a method: error_page 497 https: // $ host: $ server_port $ request_uri;
497 indicates the error code used to connect to https over http. Once an error occurs, redirect it to https.