# upstream sent invalid HTTP version while reading response header from upstream

- **ID:** `nginx/upstream-sent-invalid-http-version`
- **Domain:** nginx
- **Category:** protocol_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The upstream server returns a response with an unrecognized or malformed HTTP version string (e.g., HTTP/1.0, HTTP/2.0, or HTTP/3).

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| nginx-1.24.0 | active | — | — |
| nginx-1.25.3 | active | — | — |
| nginx-1.26.0 | active | — | — |

## Workarounds

1. **Set proxy_http_version to 1.1 or 2.0 in the location block to match the upstream server's expected protocol. Example:
location /api/ {
    proxy_pass http://backend;
    proxy_http_version 1.1;
    proxy_set_header Connection "";
}** (90% success)
   ```
   Set proxy_http_version to 1.1 or 2.0 in the location block to match the upstream server's expected protocol. Example:
location /api/ {
    proxy_pass http://backend;
    proxy_http_version 1.1;
    proxy_set_header Connection "";
}
   ```
2. **If the upstream is a custom or legacy server, ensure it returns a valid HTTP version string (e.g., 'HTTP/1.1 200 OK'). Check the upstream application logs for version misconfiguration.** (85% success)
   ```
   If the upstream is a custom or legacy server, ensure it returns a valid HTTP version string (e.g., 'HTTP/1.1 200 OK'). Check the upstream application logs for version misconfiguration.
   ```

## Dead Ends

- **** — Forcing HTTP/1.0 on a modern upstream that uses chunked encoding or keepalive will cause protocol mismatch. (60% fail)
- **** — The error is about the response version, not the request path. (90% fail)
- **** — This error is a protocol-level error, not a buffer size issue. (95% fail)
