Nginx enforces https (automatic jump from http to https)

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.