# 上游返回不支持的HTTP/2.0响应

- **ID:** `nginx/upstream-sent-http-version-not-supported`
- **领域:** nginx
- **类别:** protocol_error
- **验证级别:** ai_generated
- **修复率:** 75%

## 根因

上游服务器发送了HTTP/2.0响应，但未通过ALPN协商HTTP/2，导致协议不匹配和连接失败。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| nginx 1.20.0 | active | — | — |
| nginx 1.22.1 | active | — | — |
| nginx 1.25.0 | active | — | — |

## 解决方案

1. ```
   Configure upstream to use HTTP/1.1 instead of HTTP/2. For example, in Apache: disable HTTP/2 module; in Node.js: set HTTP/1.1 explicitly.
   ```
2. ```
   If upstream must use HTTP/2, place a reverse proxy like HAProxy or Caddy between nginx and the upstream that can downgrade HTTP/2 to HTTP/1.1.
   ```
3. ```
   Ensure upstream server correctly negotiates HTTP/2 via TLS ALPN (e.g., for nginx as upstream, use 'listen 443 ssl http2;').
   ```

## 无效尝试

- **** — Nginx proxy module does not support HTTP/2 as upstream protocol; setting it will cause configuration error. (90% 失败率)
- **** — As of nginx 1.25.x, HTTP/2 upstream is not supported in the proxy module; this is a limitation of nginx itself. (95% 失败率)
- **** — The error will recur on every request; retries do not fix the protocol mismatch. (80% 失败率)
