简体   繁体   中英

Nginx with HTTP and HTTPS but no redirect

I somehow inherited a Nginx configuration and I want to have both http and https on it in some situations. The problem is that the http variant redirects to https always and the https handshake fails since it is not yet configured.

Where is this redirect coming from if not my /etc/nginx/sites-enabled/default? My /etc/nginx/conf.d is empty and I see nothing in /etc/nginx/nginx.conf that is remotely similar to a redirect. I even tried commenting the entire HTTPS server block and it still redirects.

I want to have a development environment in Vagrant with only HTTP. The testing and production versions need to start off with HTTP and no redirect so that after I generate a Let's Encrypt certificate it will enable the redirect to HTTPS but not before I get the certificate. The Let's Encrypt certificate generation protocol (ACME) needs me to server HTTPS content.

Here is my Nginx configuration, I'm using Ansible for provisioning.

How can I disable the HTTP to HTTPS redirect? How can I debug this? Thank you!

I fixed it myself. I have been trying to fix it for two days before asking on StackOverflow.

I've been troubleshooting the Nginx config and it all seems ok because it IS OK! As I said I inherited the whole stack, not just Nginx and since it is not the Nginx config it can only mean the app does this. Check this out: FORCE_SSL: true

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM