Hello, I have a website at https://hoomixt.online . the domain is pointed to nginx self signed ssl using a type A record . with cdn / proxy being off, everything works perfectly fine, but when I turn on Cloudflare cdn / proxy, I get err_connection_reset and can’t connect . I did some testing :
when cdn is off, pinging the domain returns the nginx ip and everything works fine
when cdn is on, pinging the domain returns Cloudflare ip and the site doesn’t load
I tried using ‘curl’ on my domain, and it gave me html containing 301 Permanently Moved with cdn on
Here is my nginx config file :
server {
server_name hoomixt.onlinewww.hoomixt.online;
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/hoomixt.online/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/hoomixt.online/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 = www.hoomixt.online) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = hoomixt.online) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name hoomixt.online www.hoomixt.online;
return 404; # managed by Certbot
}
as said in the post : “I tried using ‘curl’ on my domain, and it gave me html containing 301 Permanently Moved with cdn on” when I curl the domain with cdn on it returns permanently moved 301, and in the config file in the last lines certbot automaticlly configured it so that it returns 301 in the two if statements. maybe thats the problem ?
update: after setting ssl/tls mode to “full strict”, the result was same as above, with cdn off it works fine but with it on it doesn’t . something that I noticed is trying to enter hoomixt.online in my browser redirects me to http://10.10.34.34/ after some time (and not always) . isn’t the problem with my nginx config ?
Can you turn the CDN on so I can test from my browser?
if ($host = www.hoomixt.online) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = hoomixt.online) {
return 301 https://$host$request_uri;
}
I’m not sure the point of these since they do not correct anything but they are not breaking anything else either since requesting to the IP and domain work fine.
in nginx config file the server only listens for 443 port and if as certbot configured if port is 80 it will throw 301 permanently redirected (error shown in curl) so question is why doesn’t it use the port 443 ?