nginx timeout_error ai_generated true

与上游服务器SSL握手超时

SSL handshake timeout while connecting to upstream

ID: nginx/ssl-handshake-timeout-upstream

其他格式: JSON · Markdown 中文 · English
80%修复率
85%置信度
1证据数
2024-03-15首次发现

版本兼容性

版本状态引入弃用备注
nginx 1.18.0 active
nginx 1.20.2 active
nginx 1.22.1 active

根因分析

上游服务器完成SSL握手过程缓慢,通常由高负载或网络延迟引起。

English

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

generic

官方文档

https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_ssl_handshake_timeout

解决方案

  1. 在location块中增加proxy_ssl_handshake_timeout:
    proxy_ssl_handshake_timeout 30s;
  2. 优化上游SSL配置:启用会话缓存并减少密码协商开销:
    proxy_ssl_session_reuse on;
    proxy_ssl_ciphers HIGH:!aNULL:!MD5;

无效尝试

常见但无效的做法:

  1. Increase proxy_read_timeout 90% 失败

    proxy_read_timeout controls reading response body, not SSL handshake timeout.

  2. Disable SSL verification entirely 60% 失败

    This removes security without addressing the root cause (slow handshake).

  3. Restart nginx service 95% 失败

    Restarting nginx does not affect upstream SSL handshake speed.