I got a problem with nginx. I use a reverse proxy to access some docker container, but if I use HTTP instead of HTTPS to access my domain, it will redirect to the default nginx page, and not redirect to my container.
Here's my nginx config for this boy.
server {
server_name server.name1 server.name2;
location / {
proxy_pass http://127.0.0.1:port hidden for safety; # some docker stuff
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/server.name1/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/server.name1/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
}
server {
if ($host = server.name2) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name server.name2;
return 404; # managed by Certbot
}
Here some screenshots to explain
webpage working properly if you type manually https
webpage not working, redirecting to nginx default webpage if you don't precise https
I got the same problem with some of my configs. I'm kinda new to nginx and I'm using cerbot to generate certificates. I tried to use another browser and empty cache / use icognito mode.
More, I use CloudFlare rather than OVH for DNS, and I check the "Automatic HTTPS Rewrites" was enabled, HSTS disabled.
I'm all open about suggestion for my network and how to proceed.
Thanks for your help!