简体   繁体   中英

NGINX redirect all https traffic to http

In nginx, is it possible to redirect all https requests to http? I know that I can do a rewrite rule but would it be possible to do this without having to create certificates/private keys on the nginx servers for port 443?

I need this for a web server that will only host static content on http...

Thanks a lot

For the browser to receive the redirect, TLS connection should already have been made, so this is not possible - you should set up valid certificates (no need for premium extended validation, free ones from letsencrypt are enough).

Also if previously there was a strict-transport-security header (HSTS) you probably want to set it to max-age=0 while redirecting, otherwise browsers will keep trying https

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