413 Payload Too Large

Written by Evert Pot - - Aggregated on Tuesday February 26, 2019

The 413 Payload Too Large response is used when the client sent a request with a body that’s too big.

Maybe the request was a file upload, and it exceeded the maximum file-size, or maybe it’s an API and it preemptively blocks requests that are unrealisticly large.

It’s a good idea to try and think of reasonable limits for requests, as accepting arbitrary-size HTTP requests could result in denial-of-service attacks.

If this error is temporary, a server can include a Retry-After header to indicate to the client they should just try again after a certain amount of time.

One example of a temporary status could be that the client has an upload-quota and it was exceeded.

If the reason for the error is that the server ran out of disk- space, 507 Insufficient Storage should be used instead.

Example

HTTP/1.1 413 Payload Too Large
Content-Type: text/html

<p>This endpoint does not support requests larger than 1MB</p>
HTTP/1.1 413 Payload Too Large
Retry-After: 3600
Content-Type: text/html

<p>You exceeded your quota. Try again in an hour</p>

References


« I am not my code - Cal Evans

php[architect] - The site for PHP professionals - Episode 17 – Out on a Limb »