HTTP 413 Payload Too Large — Request Entity Size Limit
About HTTP 413 Payload Too Large
HTTP 413 Payload Too Large means the request body exceeds the server's configured maximum size limit for uploads or POST data. This guide covers everything you need to know about this topic, including common causes, step-by-step solutions, and answers to frequently asked questions.
Here are the key things to understand: Server rejected the request because the body exceeds its size limit. Common with file uploads, large form submissions, and API payloads. Nginx default is 1MB (client_max_body_size), Apache default is ~2GB. Cloudflare free plan limits uploads to 100MB. The server may close the connection before the full body is received. Understanding these fundamentals will help you diagnose and resolve this issue more effectively.
The most common reasons this occurs include: Uploading files larger than the server or proxy allows. Nginx client_max_body_size set too low for your use case. CDN or WAF enforcing upload size limits. PHP post_max_size or upload_max_filesize too small. Identifying the root cause is the first step toward finding the right solution.
To resolve this, follow these recommended steps: For Nginx: increase client_max_body_size in nginx.conf (e.g., client_max_body_size 50M;). For Apache: increase LimitRequestBody in httpd.conf or .htaccess. For PHP: increase both upload_max_filesize and post_max_size in php.ini. For Node.js/Express: set bodyParser limit (app.use(express.json({ limit: '50mb' }))). If using a CDN, check their upload limits (Cloudflare: 100MB free, 500MB pro). If these steps do not resolve the issue, consider consulting additional resources or a qualified professional.
This article is part of our HTTP Status Codes collection on Error Codes Wiki. We provide comprehensive, up-to-date information to help you find solutions quickly.
Quick Answer
What is the default upload limit?
It varies: Nginx is 1MB, Apache is ~2GB, PHP is 2MB, Express.js is 100KB. Check your specific stack.
Overview
HTTP 413 Payload Too Large means the request body exceeds the server's configured maximum size limit for uploads or POST data.
Key Details
- Server rejected the request because the body exceeds its size limit
- Common with file uploads, large form submissions, and API payloads
- Nginx default is 1MB (client_max_body_size), Apache default is ~2GB
- Cloudflare free plan limits uploads to 100MB
- The server may close the connection before the full body is received
Common Causes
- Uploading files larger than the server or proxy allows
- Nginx client_max_body_size set too low for your use case
- CDN or WAF enforcing upload size limits
- PHP post_max_size or upload_max_filesize too small
Steps
- 1For Nginx: increase client_max_body_size in nginx.conf (e.g., client_max_body_size 50M;)
- 2For Apache: increase LimitRequestBody in httpd.conf or .htaccess
- 3For PHP: increase both upload_max_filesize and post_max_size in php.ini
- 4For Node.js/Express: set bodyParser limit (app.use(express.json({ limit: '50mb' })))
- 5If using a CDN, check their upload limits (Cloudflare: 100MB free, 500MB pro)