# upstream sent HTTP/1.0 response while reading response header from upstream

- **ID:** `nginx/upstream-sent-http-1-0-response-while-reading-response-header-from-upstream`
- **Domain:** nginx
- **Category:** protocol_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Upstream server responded with HTTP/1.0 instead of HTTP/1.1, causing nginx to reject or handle headers differently.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| nginx 1.18.0 | active | — | — |
| nginx 1.20.0 | active | — | — |
| nginx 1.22.0 | active | — | — |
| nginx 1.24.0 | active | — | — |

## Workarounds

1. **Configure the upstream server to use HTTP/1.1. For example, in Apache HTTPD as upstream, set:

<IfModule mod_remoteip.c>
    RemoteIPHeader X-Forwarded-For
    RemoteIPInternalProxy 10.0.0.0/8
</IfModule>

And ensure mod_proxy_http uses HTTP/1.1 by default.** (80% success)
   ```
   Configure the upstream server to use HTTP/1.1. For example, in Apache HTTPD as upstream, set:

<IfModule mod_remoteip.c>
    RemoteIPHeader X-Forwarded-For
    RemoteIPInternalProxy 10.0.0.0/8
</IfModule>

And ensure mod_proxy_http uses HTTP/1.1 by default.
   ```
2. **Add proxy_http_version 1.1; and proxy_set_header Connection ""; to nginx location block:

location / {
    proxy_http_version 1.1;
    proxy_set_header Connection "";
    proxy_pass http://upstream;
}** (75% success)
   ```
   Add proxy_http_version 1.1; and proxy_set_header Connection ""; to nginx location block:

location / {
    proxy_http_version 1.1;
    proxy_set_header Connection "";
    proxy_pass http://upstream;
}
   ```
3. **If upstream cannot be changed, use nginx as a reverse proxy with proxy_pass http://upstream; and set proxy_http_version 1.0; to match upstream behavior:

location / {
    proxy_http_version 1.0;
    proxy_set_header Connection close;
    proxy_pass http://upstream;
}** (70% success)
   ```
   If upstream cannot be changed, use nginx as a reverse proxy with proxy_pass http://upstream; and set proxy_http_version 1.0; to match upstream behavior:

location / {
    proxy_http_version 1.0;
    proxy_set_header Connection close;
    proxy_pass http://upstream;
}
   ```

## Dead Ends

- **** — This forces nginx to use HTTP/1.0 to upstream, but the upstream might still send HTTP/1.0 responses, and nginx may still reject them if it expects HTTP/1.1. (70% fail)
- **** — The issue is not buffer size but protocol version mismatch; buffer size does not change the response version. (90% fail)
- **** — Keepalive settings affect connection reuse, not the HTTP version of responses. (80% fail)
