nginx
protocol_error
ai_generated
true
上游发送了HTTP/1.1响应,而读取响应头时预期为HTTP/1.0
upstream sent HTTP/1.1 response while reading response header from upstream
ID: nginx/upstream-sent-http-1-1-response-while-reading-response-header
85%修复率
88%置信度
1证据数
2023-11-15首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| nginx 1.20.x | active | — | — | — |
| nginx 1.22.x | active | — | — | — |
| nginx 1.24.x | active | — | — | — |
| Apache 2.4.x | active | — | — | — |
| Gunicorn 20.x | active | — | — | — |
根因分析
上游服务器返回HTTP/1.1响应,但Nginx配置为期望HTTP/1.0,导致头部解析不匹配。
English
Upstream server returns HTTP/1.1 response but Nginx is configured to expect HTTP/1.0, causing header parsing mismatch.
官方文档
https://nginx.org/en/docs/http/ngx_http_upstream_module.html#proxy_http_version解决方案
-
在location块中设置proxy_http_version为1.1:proxy_http_version 1.1;
-
如果可能,配置上游返回HTTP/1.0响应。
无效尝试
常见但无效的做法:
-
Disabling HTTP/1.1 support on upstream
60% 失败
Upstream servers often default to HTTP/1.1; disabling may break functionality.
-
Increasing proxy buffer sizes
80% 失败
Buffer size does not affect protocol version negotiation.
-
Adding proxy_set_header Host $host
90% 失败
Header manipulation doesn't change protocol version.