---
title: "413 Request Entity Too Large를 해결하고 어느 계층이 요청 본문을 거부했는지 찾기"
description: "HTTP 413 Content Too Large는 서버가 요청 본문이 너무 크다고 보고 거부했다는 뜻이에요. nginx는 이를 Request Entity Too Large라고 하고, 많은 앱은 Payload Too Large라고 해요. 테스트에서 nginx와 LogBrew API가 각각 413을 보냈고, Content-Type으로 둘을 구분했어요."
canonical: "https://logbrew.co/ko/errors/http-413"
last_updated: "2026-11-24"
---

# 413 Request Entity Too Large를 해결하고 어느 계층이 요청 본문을 거부했는지 찾기

HTTP 413 Content Too Large는 서버가 요청 본문이 너무 크다고 보고 거부했다는 뜻이에요. nginx는 이를 Request Entity Too Large라고 하고, 많은 앱은 Payload Too Large라고 해요. 테스트에서 nginx와 LogBrew API가 각각 413을 보냈고, `Content-Type`으로 둘을 구분했어요.

413이 nginx의 HTML 페이지면 `client_max_body_size`를 올리고, 앱이 보낸 JSON이면 요청을 더 작게 보내세요.

nginx 1.31.8, curl 8.7.1, jq 1.7.1 및 logbrew CLI 0.1.96 환경에서 2026년 11월 24일에 테스트

글 [Furkan Erday](https://github.com/furkanerday). LogBrew 창업자 Furkan Erday. 매일 Claude Code와 Codex로 LogBrew를 만들어요.

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

## 각 본문을 받은 계층

| 보낸 본문 | nginx가 통과시킴 | API가 받음 |
| --- | --- | --- |
| 2,166,027바이트, nginx `1m` | 아니요, `413` | 아니요 |
| 2,166,027바이트, nginx `8m` | 예 | `200` |
| 5,124,027바이트 | 예 | 아니요, `413` |
| gzip 59,602바이트 | 예 | 아니요, `413` |
| 5,124,027바이트를 반으로 나눈 2개 | 예 | 둘 다 `200` |

curl 8.7.1로 보낸 OTLP 로그 배치 5개가 nginx 1.31.8을 거쳐 로컬 LogBrew API로 갔어요.

## 요청 본문을 거부한 계층 찾기

### 413의 Content-Type 확인하기

nginx는 자체 HTML 페이지로 응답하고, `Content-Type: text/html`이며 맨 아래에 자기 이름이 있어요. `client_max_body_size 1m`에서 2,166,027바이트 배치가 이 페이지를 받았어요.

```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
```

출력

```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>
```

### 413 앞에 100 Continue가 있는지 보기

nginx는 `Content-Length`만 보고 본문을 거부했고 `100 Continue`를 보내지 않았어요. nginx가 5,124,027바이트 본문을 통과시켰을 때는 curl이 먼저 `100 Continue`를 출력하고, 그다음 앱의 JSON 413을 출력했어요. nginx가 앱의 응답에도 이 헤더를 붙이기 때문에 두 응답 모두 `Server: nginx/1.31.8`이 있었어요.

출력

```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"}
```

### nginx 오류 로그에서 해당 줄 찾기

nginx가 본문을 거부하면 기본 레벨 `error`로, 클라이언트가 보내려던 크기와 함께 1줄을 남겨요. 앱의 413은 nginx 오류 로그에 아무것도 남기지 않아요.

출력

```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"
```

### 상태 코드 옆에 upstream_status 기록하기

`http` 블록의 `log_format`에 `$content_length`와 `$upstream_status`를 추가하세요. nginx가 직접 본문을 거부하면 `upstream_status`는 `-`이고, 앱이 거부하면 `413`이에요.

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

출력

```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
```

## 해결하기

### nginx의 client_max_body_size 올리기

기본값은 `1m`이에요. 업로드를 받는 `http`, `server`, `location` 블록 중 하나에 더 큰 값을 설정하고 `nginx -s reload`를 실행하세요. `8m`에서는 nginx가 같은 2,166,027바이트 배치를 API로 넘겼고, API는 `200`으로 응답했어요.

```bash
client_max_body_size 8m;
```

출력

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

### 앱 자체 한도 아래로 유지하기

nginx 설정은 뒤에 있는 앱의 한도를 바꾸지 않아요. LogBrew API는 `/v1/logs`에서 최대 4 MiB, `/v1/events`에서 최대 2 MiB를 읽고, 413에 어느 한도인지 적어 줘요. gzip으로도 피할 수 없어요. 압축을 풀면 5,124,027바이트가 되는 59,602바이트 gzip 본문도 413을 받았어요.

출력

```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"}}
```

### 대신 배치를 나누기

한도를 올리면 413이 다음 큰 배치로 옮겨갈 뿐이에요. 5,124,027바이트, 로그 13,000개짜리 배치를 6,500개씩 2개 배치로 나누자 API가 둘 다 받았어요. LogBrew JavaScript와 Python SDK는 이 작업을 대신 해 줘요. 요청 하나에는 최대 100개 이벤트, 256 KiB가 들어가요.

출력

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

### 413 줄을 LogBrew로 보내기

LogBrew에는 nginx 연동이 없지만 OTLP 로그는 받아요. 이 명령은 액세스 로그의 413 줄과 오류 로그의 `too large body` 줄을 각각 로그 1개로 보내요. `LOGBREW_INGEST_KEY`에는 프로젝트의 `server` 키를 넣으세요. 로컬 LogBrew API는 `{}`로 응답했고, 모든 줄을 받았어요.

```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 @-
```

출력

```text
{}
```

### LogBrew CLI로 찾기

오류 로그 줄은 레벨 `error`를, 413 줄은 `warning`을 받아요. nginx가 거부한 본문만 보려면 `upstream_status=-`로 검색하세요.

```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
```

출력

```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]
```

## 테스트에서 확인한 내용

macOS 27.2의 `127.0.0.1:28413`에서 nginx 1.31.8을 실행하고, 그 뒤에 로컬 LogBrew API를 두었어요. curl 8.7.1로 `--data-binary`를 써서 OTLP 로그 배치 5개를 `/v1/logs`에 보냈어요.

`client_max_body_size 1m`에서는 nginx가 2,166,027바이트 배치를 거부했고, API는 이를 받지 못했어요. `8m`에서는 API가 gzip을 포함해 4 MiB를 넘는 배치를 모두 거부했고, 반으로 나눈 2개는 받았어요.

|  | `$status` | `$upstream_status` |
| --- | --- | --- |
| 2,166,027바이트, nginx `1m` | `413` | `-` |
| 2,166,027바이트, nginx `8m` | `200` | `200` |
| 5,124,027바이트 | `413` | `413` |
| gzip 59,602바이트 | `413` | `413` |
| 5,124,027바이트를 반으로 나눈 2개 | `200` | `200` |

## 413에 이름이 3개인 이유

RFC 9110 15.5.14절은 413을 `Content Too Large`라고 불러요. RFC 7231은 `Payload Too Large`, RFC 2616은 `Request Entity Too Large`라고 불렀어요. nginx 1.31.8은 아직 가장 오래된 이름을 보내고 LogBrew API는 `Payload Too Large`를 보내므로, 이름만으로는 누가 보냈는지 알 수 없어요.

nginx 문서의 `ngx_http_core_module`에 따르면 `client_max_body_size`의 기본값은 `1m`이고, `0`이면 검사가 꺼져요. nginx는 본문을 읽기 전에 `Content-Length`를 한도와 비교했기 때문에, 거부된 요청은 앱에 닿지 않았어요.

1. 클라이언트가 `Content-Length`를 보냄
2. nginx가 `client_max_body_size`를 확인함
3. 앱이 자체 한도까지 본문을 읽음

## LogBrew가 기록하는 내용

LogBrew는 보낸 줄을 하나씩 `nginx` 서비스의 로그 1개로 저장했어요. 줄 전체를 메시지로 남기고 필드로 나누지 않으니, 텍스트로 검색하세요.

대시보드, CLI, MCP 서버는 이 로그를 다른 LogBrew 로그와 똑같이 읽어요.

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

## 자주 묻는 질문

### 413 Content Too Large는 무슨 뜻인가요?

요청 본문이 서버가 받는 크기보다 커서 서버가 요청을 거부했다는 뜻이에요. RFC 9110은 상태 코드 413을 `Content Too Large`라고 불러요.

### 413 Request Entity Too Large와 413 Payload Too Large는 어떻게 다른가요?

다르지 않아요. 둘 다 같은 상태 코드의 옛 이름이에요. nginx는 `Request Entity Too Large`를, 많은 앱은 `Payload Too Large`를 보내요.

### nginx에서 413 Request Entity Too Large는 어떻게 해결하나요?

요청을 받는 블록에서 `client_max_body_size`를 `8m` 등으로 올리고 `nginx -s reload`를 실행하세요. 기본값은 `1m`이에요.

### client_max_body_size를 올렸는데 왜 아직 413이 나오나요?

앱에 자체 한도가 있기 때문이에요. 413이 nginx의 HTML 페이지가 아니라 JSON이면 앱이 본문을 거부한 거예요. 요청을 더 작게 보내거나 앱의 한도를 올리세요.

### gzip으로 413 오류를 해결할 수 있나요?

앱이 압축을 푼 뒤의 바이트를 센다면 안 돼요. 59,602바이트 gzip 본문은 nginx를 통과했지만, LogBrew API가 5,124,027바이트로 풀고 413을 보냈어요.

## 모든 413 줄을 1곳에서 검색

nginx 로그 줄을 OTLP 로그로 LogBrew에 보내고 대시보드, CLI, AI 에이전트에서 검색하세요. 넉넉한 무료 요금제로 시작하세요. 카드 등록은 필요 없어요.

[무료로 시작](https://logbrew.co/ko)

## 출처

- [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)

## 오류 해결법 더 보기

- [메시지와 파일, 줄을 숨기는 스크립트 오류 Script error 해결하기](https://logbrew.co/ko/errors/script-error)
- [Failed to fetch 오류를 고치고 원인 3가지를 구분하는 방법](https://logbrew.co/ko/errors/failed-to-fetch)
- [Kotlin과 Android의 java.lang.NullPointerException을 메시지로 해결하기](https://logbrew.co/ko/errors/nullpointerexception)
- [Minified React error #418과 #185를 전체 메시지와 내 코드 줄로 해결하기](https://logbrew.co/ko/errors/minified-react-error)
- [Cannot use import statement outside a module을 브라우저와 Node.js에서 해결하기](https://logbrew.co/ko/errors/cannot-use-import-statement-outside-a-module)
- [AxiosError Network Error 해결하고 3가지 원인 중 어느 것인지 찾기](https://logbrew.co/ko/errors/axios-network-error)
- [HTTP 499 오류를 해결하고 누가 먼저 기다리기를 멈췄는지 찾기](https://logbrew.co/ko/errors/http-499)
- [직접 재현한 오류와 각각의 해결법](https://logbrew.co/ko/errors)
