解决 Envoy 报错 router upstream reset before response headers 修复
排查 Envoy 反向代理输出 upstream reset before response headers (503 UC),分析连接复用、TCP RST 与超时配置。
问题现象
网格服务调用报错 HTTP 503,Envoy 访问日志记录标志 UC (Upstream Connection Termination):
[2026-11-15T09:12:00.123Z] "GET /data HTTP/1.1" 503 UC 0 0 15 - "-" "curl/7.68.0" "req-1" "backend" "10.244.0.5:8080" router upstream reset before response headers, reset reason: connection termination
触发根因
- Upstream 服务闲置超时设置小于 Envoy:后端先行发送 TCP FIN/RST 拆除连接,而 Envoy 恰好在此瞬间选定并复用了该连接;
- 上游服务在读取完请求前直接崩溃退出。
解决步骤
将后端的 Idle Timeout 调整大于 Envoy
确保 Envoy 的 common_http_protocol_options.idle_timeout 严格小于后端容器的连接超时:
clusters:
- name: backend_service
connect_timeout: 0.25s
type: STRICT_DNS
common_http_protocol_options:
idle_timeout: 30s
在 Envoy 路由中配置对连接重置的安全重试
对特定连接断开情况允许幂等重试:
routes:
- match: { prefix: "/" }
route:
cluster: backend_service
retry_policy:
retry_on: "connect-failure,refused-stream,reset"
num_retries: 2
验证确认
验证长连接高并发请求:
日志中 503 UC 标志归零,连接优雅回收并自动重试成功。


