I have a website which is properly handling all traffic and redirecting everything to https, except for www traffic. I followed this related question, but it didn't seem to fix it. This is my first time setting this up - any advice is appreciated. My goal is to redirect www.my_website.com to https://my_website.com, but currently it is redirecting to http://www.my_website.com
My DNS is set up as follows:
Type | Name | Data | Seconds
--------------------------------------
A | @ | my_public_ip | Automatic
A | www | my_public_ip | Automatic
And my nginx is as follows:
server {
listen 80;
server_name _;
return 301 https://my_website.com;
}
# HTTPS server
server {
listen 443 ssl;
server_name my_website.com;
ssl_certificate some_random.crt;
ssl_certificate_key some_random.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
root html;
index index.html index.htm;
proxy_pass http://localhost:8080;
}
}