Score:0

Nginx 502 bad gateway SSL routines:ssl3_read_bytes:tlsv1 alert decrypt error:SSL alert number 51

br flag

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?

us flag
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.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.