Nginx: [error] SSL_do_handshake() failed (SSL: error:0A000410:SSL routines::sslv3 alert handshake failure) while SSL handshaking to upstream
Nginx couldn't complete TLS to an HTTPS backend (proxy_pass https://...), so clients get 502.
SSL_do_handshake() failed (SSL: error:0A000410:SSL routines::sslv3 alert handshake failure) while SSL handshaking to upstream[error] SSL_do_handshake() failed while SSL handshaking to upstreamupstream SSL certificate verify error: (20:unable to get local issuer certificate) while SSL handshaking to upstreamSSL_do_handshake() failed (SSL: error:14094410) while SSL handshaking to upstream502 Bad Gateway SSL handshaking to upstream Meaning
Typical fixes: send SNI (proxy_ssl_server_name on; and proxy_ssl_name backend.example.com;), match TLS versions/ciphers (proxy_ssl_protocols TLSv1.2 TLSv1.3;), trust the backend's CA (proxy_ssl_trusted_certificate + proxy_ssl_verify on), or provide a client cert for mTLS. Many CDNs/hosts require SNI.
Common causes
- SNI not sent to the upstream (name-based TLS vhost)
- TLS version/cipher mismatch
- Upstream certificate untrusted/hostname mismatch (when verifying)
- Upstream requires a client certificate
- Backend speaks HTTP on that port
⚡ Quick fix
proxy_ssl_server_name on; proxy_ssl_name $proxy_host;- Align
proxy_ssl_protocols - Add
proxy_ssl_trusted_certificateandproxy_ssl_verify on
Detailed fix by platform
Linux
openssl s_client -connect backend:443 -servername backend.example.com </dev/null | head
How to diagnose
- SNI — proxy_ssl_server_name?
- TLS — Versions overlap?
- Verify — CA/hostname?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in Nginx / Apache
- nginx: [emerg] unknown directive Nginx: nginx: [emerg] unknown directive "x" in /etc/nginx/sites-enabled/x:12 — configuration file test failed
- upstream timed out Nginx: upstream timed out (110: Connection timed out) while reading response header from upstream
- AH00558 Apache: AH00558: apache2: Could not reliably determine the server's fully qualified domain name
Other ways to find it
Where this error sits
Origin: Edge & web server. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 5 Nov 2026