# client intended to send too large body: 1048577 bytes exceeds client_body_buffer_size

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

## Root Cause

The request body size exceeds the client_body_buffer_size directive, causing nginx to reject or buffer to disk; if client_body_max_size is also exceeded, nginx returns 413.

## Version Compatibility

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

## Workarounds

1. **Increase client_body_buffer_size in http, server, or location block:
client_body_buffer_size 2m;
This allows larger bodies to be buffered in memory.** (90% success)
   ```
   Increase client_body_buffer_size in http, server, or location block:
client_body_buffer_size 2m;
This allows larger bodies to be buffered in memory.
   ```
2. **If the body size is expected to be large, also increase client_body_max_size:
client_body_max_size 10m;
client_body_buffer_size 2m;** (95% success)
   ```
   If the body size is expected to be large, also increase client_body_max_size:
client_body_max_size 10m;
client_body_buffer_size 2m;
   ```
3. **For specific endpoints, set a higher buffer size only for that location:
location /upload {
    client_body_buffer_size 4m;
    client_body_max_size 100m;
}** (85% success)
   ```
   For specific endpoints, set a higher buffer size only for that location:
location /upload {
    client_body_buffer_size 4m;
    client_body_max_size 100m;
}
   ```

## Dead Ends

- **** — Setting to 0 disables buffering entirely, which may cause nginx to use temporary files inefficiently and slow down. (50% fail)
- **** — The error specifically mentions client_body_buffer_size; increasing max size alone does not resolve the buffer limit warning. (70% fail)
- **** — This may cause nginx to forward the body immediately but can lead to upstream timeouts or resource issues. (60% fail)
