Fix n8n Webhook 413 Payload Too Large on Docker & Nginx (The 3-Layer Solution)
说明与用途
通过配置 Nginx、n8n 和 Node.js 的限制,Webhook 大小可达 64 MiB,无 413 错误,工作流正常执行。
问题
n8n webhooks return HTTP 413 or PayloadTooLargeError when receiving large payloads, even after setting Nginx client_max_body_size.
结果
After adjusting Nginx, n8n, and Node.js limits, large webhook payloads up to 64 MiB are accepted, 413 errors disappear, and workflows execute fully.
工作流
- 1. Identify rejecting layer by sending test payload to public URL and to localhost; inspect response and logs.
- 2. If Nginx rejects, edit /etc/nginx/sites-available/n8n to set client_max_body_size 64m for webhook locations and adjust timeouts.
- 3. If n8n rejects, update docker‑compose.yml with environment variables N8N_PAYLOAD_SIZE_MAX=64, N8N_FORMDATA_FILE_SIZE_MAX=250, N8N_DEFAULT_BINARY_DATA_MODE=filesystem, NODE_OPTIONS=--max-old-space-size=4096.
- 4. Recreate container with docker compose up -d --force-recreate and verify env vars.
- 5. Re‑run 20 MB test payload through public URL to confirm HTTP 200 and execution history.
- 6. Apply best practices: keep Nginx limit ≥ n8n limit, avoid base64 binaries, consider Cloudflare limits.
证据
Why raising Nginx client_max_body_size still triggers 413 errors on n8n webhooks.
The workflow execution log in n8n is completely blank.
client_max_body_size 1MB Default
N8N_PAYLOAD_SIZE_MAX 16MiB Default
NODE_OPTIONS=--max-old-space-size=4096
- 记录日期: 2026-10-11T09:41:19.250Z