Search code examples
nginxweb-deploymentcloudflare

522 Error while using CloudFlare proxy (works fine when not)


I am very new to CloudFlare, and don’t really understand how it works. However, i got an issue : when I try to access my website using CloudFlare proxy, I get 522 error, telling me that my server isn’t responding ; I read as much as I could to fix that issue, but all that was said didn’t matched with my problem : my tls certificate is fine (even if self-signed), my server (docker containers+nginx) runs correctly, and the most absurd : I am able to access to my website if I use DNS Only option. My SSL/TLS configuration is on Full, so it would fix the problem, but it doesn’t. Also, I can access the website from IP while i think CloudFlare should unable it. Here is my nginx configuration :

    #user nobody;
    worker_processes 1;
    #error_log logs/error.log;
    #error_log logs/error.log notice;
    #error_log logs/error.log info;
    #pid logs/nginx.pid;
    events {
    worker_connections 1024;
    }
    http {
    server {
    server_name example.com;
    listen 80;
    listen [::]:80;
    return 301 https://$host$request_uri;
    }
    server {
    server_name example.com;
    listen 443 ssl;
    listen [::]:443 ssl;
    ssl_protocols TLSv1.3;
    ssl_certificate /path/to/cert.pem;
    ssl_certificate_key /path/to/key.pem;
    ssl_dhparam /path/to/dhparam.pem;
    ssl_session_timeout 1d;
    ssl_session_cache shared:SSL:50m;
    add_header Strict-Transport-Security max-age=15768000;
    location / {
    proxy_pass http://localhost:5000;
    }
    }
    }

TLS config : Full DNS : AAAA pointing to my server’s ip

What i tried : delete website configurations, change DNS and SSL configs

I hope this issue is fixable


Solution

  • I fixed it a long time ago, I just forgot the firewall.