I did this simple ngninx config to redirect http://example.com, http://www.example.comhttps://www.example.comto https://example.com
Everything works as expected with chrome, but I noticed Firefox needs the certficate for www.example.com and do not redirect it to https://example.com.
I ideally want to keep only one certificate and taking profit of the redirection.
server { listen 80; listen [::]:80; server_name example.com www.example.com; return 301 https://example.com$request_uri;}server { server_name example.com www.example.com; location / { proxy_pass http://localhost:3000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/examplecom/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot}