# 413 Request Entity Too Large: client intended to send too large body: 2097152 bytes exceeds client_max_body_size

- **ID:** `nginx/client-body-buffer-size-exceeded-with-413`
- **Domain:** nginx
- **Category:** config_error
- **Error Code:** `413`
- **Verification:** ai_generated
- **Fix Rate:** 95%

## Root Cause

The HTTP request body size exceeds the limit set by the client_max_body_size directive in nginx configuration.

## Version Compatibility

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

## Workarounds

1. **Increase client_max_body_size in the http, server, or location block. Example:
  http {
      client_max_body_size 10m;
  }** (95% success)
   ```
   Increase client_max_body_size in the http, server, or location block. Example:
  http {
      client_max_body_size 10m;
  }
   ```
2. **If using a reverse proxy, also ensure the upstream server (e.g., PHP-FPM, Node.js) has matching body size limits. For PHP-FPM, edit php.ini:
  upload_max_filesize = 10M
  post_max_size = 10M** (85% success)
   ```
   If using a reverse proxy, also ensure the upstream server (e.g., PHP-FPM, Node.js) has matching body size limits. For PHP-FPM, edit php.ini:
  upload_max_filesize = 10M
  post_max_size = 10M
   ```

## Dead Ends

- **Increase client_body_buffer_size only** — The error is about client_max_body_size, not client_body_buffer_size. Buffer size is separate from the maximum allowed body size. (90% fail)
- **Set client_max_body_size in a location block without specifying the server block** — If the location block is inside a server block that has a smaller limit, the server block limit may still apply depending on inheritance. Must set at http, server, or location level correctly. (50% fail)
- **Increase system file descriptor limits** — This is a request size limit, not a file descriptor issue. (100% fail)
