# SSL handshake timeout while connecting to upstream

- **ID:** `nginx/ssl-handshake-timeout-upstream`
- **Domain:** nginx
- **Category:** timeout_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Upstream server is slow to complete the SSL handshake, often due to high load or network latency.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| nginx 1.18.0 | active | — | — |
| nginx 1.20.2 | active | — | — |
| nginx 1.22.1 | active | — | — |

## Workarounds

1. **Increase proxy_ssl_handshake_timeout in the location block:
proxy_ssl_handshake_timeout 30s;** (85% success)
   ```
   Increase proxy_ssl_handshake_timeout in the location block:
proxy_ssl_handshake_timeout 30s;
   ```
2. **Optimize upstream SSL configuration: enable session caching and reduce cipher negotiation overhead:
proxy_ssl_session_reuse on;
proxy_ssl_ciphers HIGH:!aNULL:!MD5;** (75% success)
   ```
   Optimize upstream SSL configuration: enable session caching and reduce cipher negotiation overhead:
proxy_ssl_session_reuse on;
proxy_ssl_ciphers HIGH:!aNULL:!MD5;
   ```

## Dead Ends

- **Increase proxy_read_timeout** — proxy_read_timeout controls reading response body, not SSL handshake timeout. (90% fail)
- **Disable SSL verification entirely** — This removes security without addressing the root cause (slow handshake). (60% fail)
- **Restart nginx service** — Restarting nginx does not affect upstream SSL handshake speed. (95% fail)
