Enforce HTTPS
CriticalHTTPS encrypts all data between the browser and server. Without it, credentials, form data, and sessions are exposed in plaintext on the network.
- Install an SSL/TLS certificate (Let's Encrypt is free)
- Force redirect all HTTP traffic to HTTPS (301 redirect)
- Enable HSTS to prevent protocol downgrade attacks
- Never run production without HTTPS — ever
server {
listen 80;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
add_header Strict-Transport-Security "max-age=31536000" always;
}