# 上游发送了HTTP/1.1响应，而读取响应头时预期为HTTP/1.0

- **ID:** `nginx/upstream-sent-http-1-1-response-while-reading-response-header`
- **领域:** nginx
- **类别:** protocol_error
- **验证级别:** ai_generated
- **修复率:** 85%

## 根因

上游服务器返回HTTP/1.1响应，但Nginx配置为期望HTTP/1.0，导致头部解析不匹配。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| nginx 1.20.x | active | — | — |
| nginx 1.22.x | active | — | — |
| nginx 1.24.x | active | — | — |
| Apache 2.4.x | active | — | — |
| Gunicorn 20.x | active | — | — |

## 解决方案

1. ```
   在location块中设置proxy_http_version为1.1：proxy_http_version 1.1;
   ```
2. ```
   如果可能，配置上游返回HTTP/1.0响应。
   ```

## 无效尝试

- **Disabling HTTP/1.1 support on upstream** — Upstream servers often default to HTTP/1.1; disabling may break functionality. (60% 失败率)
- **Increasing proxy buffer sizes** — Buffer size does not affect protocol version negotiation. (80% 失败率)
- **Adding proxy_set_header Host $host** — Header manipulation doesn't change protocol version. (90% 失败率)
