0

I'm handling a website build using nginx as web layer and apache as app layer, previously the website running smooth, but recently, the website start showing 502 bad gateway nginx, the 502 bad gateway is not always showing, it only several minutes one time, after that if you refresh browser, the website might or might not recover from that, so I assume the problem is happen on the web layer nginx server, i have check the error log,

Error:

SSL_do_handshake() failed (SSL: error:xxx:SSL routines:ssl3_read_bytes:tlsv1 alert decrypt error:SSL alert number 51) while SSL handshaking to upstream, client: xxx.xxx.xxx.xxx, server: domain.name, request: "GET /xxx HTTP/1.1", upstream: "https://xxx.xxx.xxx.xxx:443/xxx", host: "domain.name", referrer: "https://domain.name/"

Nginx config:

upstream domain.name-https {

    ip_hash;
    server xxx.xxx.xxx.xxx:443;

}

server {

    listen       80;
    server_name  domain.name www.domain.name;

    location / {

        add_header X-Frame-Options         'SAMEORIGIN';
        add_header X-XSS-Protection        '1; mode=block';

        proxy_pass                         https://domain.name-https;
        proxy_set_header Host              $host;
        proxy_set_header X-Forwarded-For   $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;

        proxy_cookie_path /                '/; domain:.domain.name; HttpOnly';
        proxy_intercept_errors             on;

    }

    access_log /var/log/nginx/domains/domain.name.access.log;
    error_log  /var/log/nginx/domains/domain.name.error.log warn;

}

Anyone know what is happening and how to fix this?

  • The problem is most likely in the upstream server. The negotiation of TLS connection fails, maybe due to upstream server overload or some other condition. You need to check the upstream server logs to see what is happening. – Tero Kilkanen Jan 16 '22 at 18:24

0 Answers0