# SSL_do_handshake() failed (SSL: error:14094418:SSL routines:ssl3_read_bytes:tlsv1 alert unexpected message) while SSL handshaking to upstream

- **ID:** `nginx/ssl-do-handshake-failed-sslv3-alert-unexpected-message`
- **Domain:** nginx
- **Category:** protocol_error
- **Error Code:** `error:14094418`
- **Verification:** ai_generated
- **Fix Rate:** 78%

## Root Cause

Upstream server expects a different TLS protocol version or cipher suite than what nginx is offering, often due to misconfigured SSL/TLS settings or incompatible server software.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| nginx 1.24.0 | active | — | — |
| nginx 1.25.3 | active | — | — |
| nginx 1.26.0 | active | — | — |
| OpenSSL 1.1.1w | active | — | — |
| OpenSSL 3.0.13 | active | — | — |

## Workarounds

1. **Set ssl_protocols and ssl_ciphers to match upstream requirements: proxy_ssl_protocols TLSv1.2; proxy_ssl_ciphers HIGH:!aNULL:!MD5;** (85% success)
   ```
   Set ssl_protocols and ssl_ciphers to match upstream requirements: proxy_ssl_protocols TLSv1.2; proxy_ssl_ciphers HIGH:!aNULL:!MD5;
   ```
2. **Disable SSL verification for upstream if using self-signed certs: proxy_ssl_verify off; proxy_ssl_session_reuse on;** (75% success)
   ```
   Disable SSL verification for upstream if using self-signed certs: proxy_ssl_verify off; proxy_ssl_session_reuse on;
   ```
3. **Use a specific cipher suite that both sides support: proxy_ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384;** (80% success)
   ```
   Use a specific cipher suite that both sides support: proxy_ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384;
   ```

## Dead Ends

- **Upgrade OpenSSL to the latest version** — The error is not about OpenSSL version mismatch but about protocol negotiation; upgrading alone doesn't fix incompatible cipher or version settings. (70% fail)
- **Set ssl_protocols TLSv1.2 TLSv1.3 on nginx side only** — The upstream may require a specific TLS version that is not in the list; both sides must be configured consistently. (80% fail)
- **Ignore the error and retry** — The error persists until the SSL configuration is corrected; retrying without changes leads to repeated failures. (90% fail)
