Fix · nginx
Fix “HTTP redirects to HTTPS” on nginx
Answer every http:// request with a 301 redirect to the https:// URL (and enable HSTS once that works).
server {
listen 80;
server_name _;
return 301 https://$host$request_uri;
}
Verify the fix
Re-run the HTTP redirects to HTTPS check after deploying. Test config changes in staging first and keep a rollback: a wrong header can break a site faster than a missing one.
Other stacks: Apache · Caddy · Express / Node · Cloudflare