# client intended to send too large body: body size exceeds client_body_buffer_size

- **ID:** `nginx/client-body-buffer-overflow`
- **Domain:** nginx
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 90%

## Root Cause

Nginx buffers the request body to a temporary file when it exceeds client_body_buffer_size, but if the body is too large and client_max_body_size is not properly set, the connection is rejected.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| nginx 1.24.0 | active | — | — |
| nginx 1.22.1 | active | — | — |
| nginx 1.20.2 | active | — | — |

## Workarounds

1. **Increase client_max_body_size in http, server, or location block to allow larger bodies: `client_max_body_size 50M;`** (90% success)
   ```
   Increase client_max_body_size in http, server, or location block to allow larger bodies: `client_max_body_size 50M;`
   ```
2. **Ensure client_body_buffer_size is set appropriately (e.g., 128k) and that the system has enough disk space for temporary files in the path defined by client_body_temp_path.** (80% success)
   ```
   Ensure client_body_buffer_size is set appropriately (e.g., 128k) and that the system has enough disk space for temporary files in the path defined by client_body_temp_path.
   ```
3. **Check the actual body size in logs and set client_max_body_size accordingly. For file uploads, ensure the frontend sends the correct Content-Length header.** (85% success)
   ```
   Check the actual body size in logs and set client_max_body_size accordingly. For file uploads, ensure the frontend sends the correct Content-Length header.
   ```

## Dead Ends

- **** — client_body_buffer_size only controls in-memory buffering; client_max_body_size is the actual limit. (70% fail)
- **** — This can cause upstream servers to receive partial data and may break applications that expect full body. (50% fail)
- **** — proxy_buffer_size is for response headers, not request bodies. (90% fail)
