Fix: Nginx 413 Request Entity Too Large

The Cause

Nginx's default client_max_body_size is 1MB. File uploads, API payloads, and image uploads larger than 1MB get rejected with 413.

The Fix

Increase client_max_body_size in your server block
server {
    listen 443 ssl;
    server_name yourdomain.com;

    # Increase to 50MB for file uploads:
    client_max_body_size 50M;

    location / {
        proxy_pass http://127.0.0.1:3000;
    }
}

Set it in the location block for a specific endpoint, in the server block for the whole site, or in http {} in nginx.conf for all sites.

nginx -t && systemctl reload nginx

Paste your config to detect proxy misconfigurations and get exact fixes.

Open Reverse Proxy Mapper →

Frequently Asked Questions

What is Nginx's default upload size limit?
Nginx's default client_max_body_size is 1MB (1m). Any request body larger than this is rejected with 413. Set it to 0 to disable the limit entirely, though this is not recommended on public-facing servers.
Does client_max_body_size affect JSON API requests?
Yes. Large JSON payloads — bulk API requests, batch data imports — are also subject to client_max_body_size. If your API returns 413 on large POST requests, increase this value in the relevant location or server block.