Applies to: Nginx 1.31.6, Apache 2.4.68, PHP 8.3, WordPress, cPanel hosting and Cloudflare (Cloudflare limits from its documentation)

413 Request Entity Too Large (RFC 9110 now calls it “Content Too Large”) means the data you sent, usually a file upload, is bigger than the server allows. Several layers can each have their own limit; the smallest one wins, so check them in this order.

1. Nginx: client_max_body_size

Nginx allows 1 MB by default. In our test, a 2 MB upload got 413 Request Entity Too Large and the error log said client intended to send too large body: 2000000 bytes. Raise it in the http, server or location block:

client_max_body_size 64m;
sudo nginx -t && sudo systemctl reload nginx

2. Apache: LimitRequestBody

Current Apache versions allow 1 GB by default. A lower value in the configuration or in .htaccess gives a 413; with LimitRequestBody 1048576 (1 MB) our 2 MB upload was refused. Raise or remove that line.

3. PHP: upload_max_filesize and post_max_size

PHP doesn’t send a 413; instead the upload fails inside the application. WordPress, for example, reports that the file exceeds upload_max_filesize. PHP’s built-in defaults are small: 2M for upload_max_filesize and 8M for post_max_size. Set post_max_size a little higher than upload_max_filesize.

4. Cloudflare

If your site uses Cloudflare’s proxy, uploads are limited by your Cloudflare plan: 100 MB on Free and Pro, 200 MB on Business, according to Cloudflare. Bigger uploads get a 413 from Cloudflare before they reach your server. Upload large files through a hostname that isn’t proxied, or use SFTP.

Test after each change

head -c 20000000 /dev/zero > /tmp/test20mb.bin
curl -s -o /dev/null -w "%{http_code}\n" --data-binary @/tmp/test20mb.bin https://example.com/upload-test

If the code changes from 413 to anything else, that layer now lets the upload through. For very large files (backups, videos), SFTP or rsync is more reliable than a web form.

Official documentation: Cloudflare error 413.

Related services

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Unmanaged dedicated servers

full root access and free IPMI KVM, with Free Basic Managed Support.

Managed dedicated servers

our engineers look after the server for you, from $135 a month.

Was this answer helpful?

Still stuck? Open a ticket