A 413 is the server refusing what you sent because it is too big. Not malformed, not forbidden, not missing: the request arrived carrying more data than something on the way was willing to accept, and it was turned away at the door.

The name has changed twice, which is why people search for three versions of it. Older servers say “Request Entity Too Large”, some say “Payload Too Large”, and the current standard, RFC 9110, calls it “Content Too Large”. It is the same code. In the RFC’s words, the server “is refusing to process a request because the request content is larger than the server is willing or able to process”.

What it means, in plain words

If you saw this while uploading something to a website: the file, or the form with the file in it, was larger than that site accepts. Nothing is wrong with your file or your connection. The limit is a setting on the site’s side, and sometimes it is set far lower than the site intended.

What helps from your end is making the upload smaller: a compressed image instead of the original, a shorter video, a PDF without embedded pictures. If the site says it accepts files of a certain size and yours is under it, tell them the exact size of the file and what you were uploading, because then their limit is not the one they think it is.

The limit is rarely in your application

Most guides send you to your framework’s upload setting. That setting is real, but a request passes through several layers before your code sees it, each with its own ceiling, and the smallest limit anywhere on the path is the one that applies.

nginx. Its documentation for client_max_body_size gives the default as 1m, one megabyte, and says that a larger body gets “the 413 (Request Entity Too Large) error”. One megabyte is smaller than many phone photos. An application configured to accept 50 MB uploads, behind an nginx nobody configured, accepts nothing over 1 MB.

A CDN or proxy in front. Cloudflare’s documentation gives the maximum upload size by plan: 100 MB on Free and Pro, 200 MB on Business, and up to 5 GB on Enterprise, with “413 Request Entity Too Large” for anything over. A video upload that works against your origin directly fails the day the domain goes behind the proxy.

The application and its framework. Your own limit, which is usually the one somebody set on purpose.

So when a 413 appears after a change that never touched upload code, the first question is which layer changed: a new proxy, a new host, a container image with a stock nginx configuration.

Which layer said no

The response usually tells you, if you look at it rather than at the status code. Open the network panel, click the failed request and read three things:

  • The Server header. nginx, cloudflare, or the name of your application server.
  • The body. nginx’s default error page is titled “413 Request Entity Too Large”; a CDN’s page carries its own branding; your application’s error is usually JSON in your own format.
  • A cf-ray header, which means the request went through Cloudflare, whichever layer refused it.

The layer whose page you are looking at is the one to change. Raising the application’s limit while nginx is the one answering does nothing at all, which is the most common afternoon lost to this.

Session Replay

Free Chrome extension. One click on the page that is misbehaving captures the screenshot, the console and the network log, and hands you a link to paste into the ticket.

Get the extension

The upload that is bigger than the file

The size that counts is the request body, and it is often bigger than the file the person chose.

The classic case is an image sent inside JSON as base64. Base64 turns every three bytes into four characters, so the encoded file is a third larger than the original before any other field is added. A 900 KB photo becomes about 1.2 MB of JSON, which is over nginx’s default even though the file itself was under it. A multipart form upload adds a little on top of the file as well, and a form that sends several files at once is one request carrying all of them.

If the limit is 1 MB and users report that “small” images fail, measure the request body in the network panel, not the file on their disk.

A warning in nginx’s own documentation

The same paragraph that sets the default carries a sentence worth knowing: “Please be aware that browsers cannot correctly display this error.” The RFC also allows a server to close the connection on an oversized request rather than read it to the end.

So a 413 does not always reach the person as a tidy error page. Depending on the browser, the server and how far the upload got, what the user sees can be a page that never finishes, a form that does nothing, or, from code, the generic TypeError: Failed to fetch. When we tested a server that answers 413 and closes the connection immediately, Chrome’s fetch did receive the 413 status correctly, so this is a possibility to check for rather than something that always happens. The network panel shows which one you have.

If it is your site

  1. Find the layer from the Server header and the error body, as above.
  2. Raise the limit at that layer, and at every layer behind it that is now the smallest. For nginx that is client_max_body_size in the http, server or location block that serves the upload route, not the whole site.
  3. Tell the user the limit before they upload, in the form, and check the file size in the browser before sending. A 413 after a three-minute upload is the worst way to learn a number.
  4. For large files, stop sending them through the web server at all. Uploading in chunks, or straight to object storage with a signed URL, removes the ceiling instead of moving it.

In one paragraph

A 413 means the request was larger than something on the path accepts. Several layers each have a limit, the smallest one wins, and it is often a default nobody chose: nginx’s is one megabyte. Read the Server header and the error body to find which layer refused, change that one, and remember that base64 makes a file a third bigger on the way. Unlike a 405 or a 400, there is something a visitor can do: send a smaller file.