---
title: "Fix 413 Request Entity Too Large and find which layer refused it"
description: "HTTP 413 Content Too Large, also sent as 413 Request Entity Too Large or 413 Payload Too Large, means a server refused a request body as too big. Its Content-Type shows which layer sent it."
canonical: "https://logbrew.co/en/errors/http-413"
last_updated: "2026-11-24"
---

# Fix 413 Request Entity Too Large and find which layer refused it

HTTP 413 Content Too Large, also sent as 413 Request Entity Too Large or 413 Payload Too Large, means a server refused a request body as too big. Its `Content-Type` shows which layer sent it.

Raise `client_max_body_size` when the 413 is the nginx HTML page, and send smaller requests when it is JSON from your app.

Tested on November 24, 2026 with nginx 1.31.8, curl 8.7.1, jq 1.7.1, and logbrew CLI 0.1.96

By [Furkan Erday](https://github.com/furkanerday). Furkan Erday is the founder of LogBrew. He builds LogBrew with Claude Code and Codex every day.

Canonical: https://logbrew.co/en/errors/http-413

## Which layer took each body

| Body we sent | nginx passed it on | The API took it |
| --- | --- | --- |
| 2,166,027 bytes, nginx at `1m` | No, `413` | No |
| 2,166,027 bytes, nginx at `8m` | Yes | `200` |
| 5,124,027 bytes | Yes | No, `413` |
| 59,602 bytes of gzip | Yes | No, `413` |
| 5,124,027 bytes in 2 halves | Yes | `200` for both |

5 OTLP log batches through nginx 1.31.8 to a local LogBrew API, sent by curl 8.7.1.

## Find the layer that refused the body

### Read the Content-Type of the 413

nginx answers with its own HTML page, `Content-Type: text/html`, and its name at the bottom. At `client_max_body_size 1m`, our batch of 2,166,027 bytes got this page.

```bash
curl -sS -i http://127.0.0.1:28413/v1/logs \
  -H "x-logbrew-key: $LOGBREW_INGEST_KEY" -H 'Content-Type: application/json' \
  --data-binary @batch-2mb.json
```

Output

```text
HTTP/1.1 413 Request Entity Too Large
Server: nginx/1.31.8
Date: Tue, 24 Nov 2026 01:17:12 GMT
Content-Type: text/html
Content-Length: 183
Connection: close

<html>
<head><title>413 Request Entity Too Large</title></head>
<body>
<center><h1>413 Request Entity Too Large</h1></center>
<hr><center>nginx/1.31.8</center>
</body>
</html>
```

### Look for 100 Continue before the 413

nginx refused our body from its `Content-Length` and sent no `100 Continue`. When nginx let a body of 5,124,027 bytes through, curl printed `100 Continue` first, then the app's 413 in JSON. Both answers had `Server: nginx/1.31.8`, because nginx sets that header on the app's answers too.

Output

```text
HTTP/1.1 100 Continue

HTTP/1.1 413 Payload Too Large
Server: nginx/1.31.8
Date: Tue, 24 Nov 2026 01:21:54 GMT
Content-Type: application/json
Content-Length: 82
Connection: keep-alive

{"message":"request body is over 4 MiB after decompression; send smaller batches"}
```

### Find the line in the nginx error log

When nginx refuses a body, it writes 1 line at the default level `error`, with the size the client meant to send. The app's 413 adds nothing to the nginx error log.

Output

```text
2026/11/24 04:17:12 [error] 28243#0: *6 client intended to send too large body: 2166027 bytes, client: 127.0.0.1, server: , request: "POST /v1/logs HTTP/1.1", host: "127.0.0.1:28413"
```

### Log upstream_status beside the status

Add `$content_length` and `$upstream_status` to a `log_format` in the `http` block. `upstream_status` is `-` when nginx refused the body itself, and `413` when the app refused it.

```bash
log_format body '$remote_addr "$request" $status '
                'content_length=$content_length upstream_status=$upstream_status';
access_log /var/log/nginx/body.log body;
```

Output

```text
127.0.0.1 "POST /v1/logs HTTP/1.1" 413 content_length=2166027 upstream_status=-
127.0.0.1 "POST /v1/logs HTTP/1.1" 413 content_length=5124027 upstream_status=413
```

## Fix it

### Raise client_max_body_size in nginx

The default is `1m`. Set a larger value in the `http`, `server`, or `location` block that takes the upload, then run `nginx -s reload`. At `8m`, nginx passed the same batch of 2,166,027 bytes to the API, and the API answered `200`.

```bash
client_max_body_size 8m;
```

Output

```text
127.0.0.1 "POST /v1/logs HTTP/1.1" 200 content_length=2166027 upstream_status=200
```

### Stay under the app's own limit

nginx does not change the limit of the app behind it. The LogBrew API reads at most 4 MiB on `/v1/logs` and 2 MiB on `/v1/events`, and its 413 says which. Gzip does not get past it. A gzip body of 59,602 bytes that opened to 5,124,027 bytes got a 413 too.

Output

```text
{"code":"payload_too_large","error":"request body is over 2097152 bytes","limit_bytes":2097152,"next":"send under limit_bytes per request; split a batch into smaller requests","next_action":{"code":"split_batch","target":"request"}}
```

### Split the batch instead

A larger limit only moves the 413 to the next big batch. We split the batch of 5,124,027 bytes and 13,000 logs into 2 batches of 6,500, and the API took both. The LogBrew JavaScript and Python SDKs do this for you. Each request holds at most 100 events and 256 KiB.

Output

```text
batch-5mb.json 413
batch-5mb-part1.json 200
batch-5mb-part2.json 200
```

### Send the 413 lines to LogBrew

LogBrew has no nginx integration, but it takes OTLP logs. This command sends each 413 line of the access log and each `too large body` line of the error log as 1 log. Set `LOGBREW_INGEST_KEY` to a `server` key of your project. Our local LogBrew API answered `{}`, so it took every line.

```bash
{ grep -E '" 413 ' /var/log/nginx/body.log; grep 'too large body' /var/log/nginx/error.log; } |
  jq -Rn '{resourceLogs: [{resource: {attributes: [{key: "service.name", value: {stringValue: "nginx"}}]}, scopeLogs: [{logRecords: [inputs | {severityText: (if test("\\[error\\]") then "ERROR" else "WARN" end), body: {stringValue: .}}]}]}]}' |
  curl -sS https://api.logbrew.co/v1/logs -H "x-logbrew-key: $LOGBREW_INGEST_KEY" \
    -H 'Content-Type: application/json' --data-binary @-
```

Output

```text
{}
```

### Find them with the LogBrew CLI

The error log line gets the level `error`, and each 413 line gets `warning`. Search for `upstream_status=-` to list only the bodies that nginx refused.

```bash
logbrew read logs --project "<project_id>" --service nginx --severity error --since 1h
logbrew read logs --project "<project_id>" --service nginx --search 'upstream_status=-' --since 1h
```

Output

```text
Logs (1)
- error 2026/11/24 04:17:12 [error] 28243#0: *6 client intended to send too large body: 2166027 bytes, client: 127.0.0.1, server: , request: "POST /v1/logs HTTP/1.1", host: "127.0.0.1:28413" service=nginx trace=ec27d913a85bdbfe8252a31cf276fccf [unversioned / production]
Logs (1)
- warning 127.0.0.1 "POST /v1/logs HTTP/1.1" 413 content_length=2166027 upstream_status=- service=nginx trace=b2f9eee905fea8254bac86a398fd8f39 [unversioned / production]
```

## What we saw when we tested it

We ran nginx 1.31.8 on macOS 27.2 at `127.0.0.1:28413`, in front of a local LogBrew API. curl 8.7.1 sent 5 OTLP log batches to `/v1/logs` with `--data-binary`.

At `client_max_body_size 1m`, nginx refused the batch of 2,166,027 bytes, and the API never saw it. At `8m`, the API refused each batch over 4 MiB, the gzip one too, and took the 2 halves.

|  | `$status` | `$upstream_status` |
| --- | --- | --- |
| 2,166,027 bytes, nginx at `1m` | `413` | `-` |
| 2,166,027 bytes, nginx at `8m` | `200` | `200` |
| 5,124,027 bytes | `413` | `413` |
| 59,602 bytes of gzip | `413` | `413` |
| 5,124,027 bytes in 2 halves | `200` | `200` |

## Why 413 has 3 names

RFC 9110 section 15.5.14 names 413 `Content Too Large`. RFC 7231 called it `Payload Too Large`, and RFC 2616 called it `Request Entity Too Large`. nginx 1.31.8 still sends the oldest name, and the LogBrew API sends `Payload Too Large`, so the name does not tell you who sent it.

The nginx docs of `ngx_http_core_module` give `client_max_body_size` a default of `1m`, and `0` turns the check off. nginx compared the limit with `Content-Length` before it read our body, so the app never saw the refused request.

1. The client sends `Content-Length`
2. nginx checks `client_max_body_size`
3. The app reads the body up to its own limit

## What LogBrew records

LogBrew stored each line we sent as 1 log of the `nginx` service. It keeps the whole line as the message and does not split it into fields, so search the text.

The dashboard, the CLI, and the MCP server read these logs like any other LogBrew log.

- `nginx`
  - `level`: `error`
  - Message: `… client intended to send too large body: 2166027 bytes …`
  - `trace`: `ec27d913a85bdbfe8252a31cf276fccf`

## Questions people ask

### What does 413 Content Too Large mean?

The server refused the request because its body is larger than the server takes. RFC 9110 names status 413 `Content Too Large`.

### What is the difference between 413 Request Entity Too Large and 413 Payload Too Large?

There is none. Both are older names of the same status. nginx sends `Request Entity Too Large`, and many apps send `Payload Too Large`.

### How do I fix 413 Request Entity Too Large in nginx?

Raise `client_max_body_size` in the block that takes the request, for example to `8m`, then run `nginx -s reload`. The default is `1m`.

### Why do I still get 413 after I raised client_max_body_size?

Your app has its own limit. If the 413 is JSON and not the nginx HTML page, the app refused the body. Send smaller requests, or raise the limit of the app.

### Does gzip fix a 413 error?

Not when the app counts the bytes after gzip. Our gzip body of 59,602 bytes passed nginx, but the LogBrew API opened it to 5,124,027 bytes and sent a 413.

## Search every 413 line in 1 place

Send your nginx log lines to LogBrew as OTLP logs, and search them from the dashboard, the CLI, or your AI agent. Start on the generous free tier, no card needed.

[Start Free](https://logbrew.co/en)

## Sources

- [RFC 9110, HTTP Semantics, 15.5.14 413 Content Too Large](https://www.rfc-editor.org/rfc/rfc9110#section-15.5.14)
- [LogBrew docs, Send OpenTelemetry data to LogBrew with OTLP](https://docs.logbrew.co/guides/opentelemetry)
- [LogBrewCo/sdk, JavaScript SDK, Queue Bounds](https://github.com/LogBrewCo/sdk/blob/main/js/logbrew-js/README.md#queue-bounds)

## More error fixes

- [Fix the script error that hides its message, file, and line](https://logbrew.co/en/errors/script-error)
- [Fix the Failed to fetch error and tell its 3 causes apart](https://logbrew.co/en/errors/failed-to-fetch)
- [Fix java.lang.NullPointerException in Kotlin and Android from its message](https://logbrew.co/en/errors/nullpointerexception)
- [Fix Minified React error #418 and #185 from the full message and your source line](https://logbrew.co/en/errors/minified-react-error)
- [Fix SyntaxError Cannot use import statement outside a module in the browser and in Node.js](https://logbrew.co/en/errors/cannot-use-import-statement-outside-a-module)
- [Fix AxiosError Network Error and find which of its 3 causes you have](https://logbrew.co/en/errors/axios-network-error)
- [Fix the HTTP 499 error and find out who stopped waiting](https://logbrew.co/en/errors/http-499)
- [JavaScript errors and JVM exceptions we reproduced, and how to fix each one](https://logbrew.co/en/errors)
