413

Payload Too Large

Official
The payload is too big for the server

Specification of the HTTP status code 413

The 413 Payload Too Large status code indicates that the server is refusing to process a request because the request payload is larger than the server is willing or able to process. The server MAY close the connection to prevent the client from continuing the request.

If the condition is temporary, the server SHOULD generate a Retry-After header field to indicate that it is temporary and after what time the client MAY try again.

Source / Quote by: The 413 Payload Too Large HTTP Status Code is specified by section 6.5.11 of RFC7231.

How to throw a 413 statuscode with PHP?

To throw the HTTP status code 413 on a web page, the PHP function http_response_code can be used. The syntax is as follows: http_response_code(413) (PHP 5 >= 5.4.0, PHP 7, PHP 8)

Test the 413 HTTP status code

In order to be able to display the HTTP status code (in this case 413 Payload Too Large) and other information on the client side, the development console must be opened with F12. Afterwards you have to navigate to the tab "Network". Now you can open the page, in the network tab you should see the web page (example index.php). This must be selected and then the Herder section must be selected. Here the user will see the following result:

Status code 413 Payload Too Large
Overview
URL: https://http-statuscode.com/errorCodeExample.php?code=413
Status: 413 Payload Too Large
Those: Network
IP address: XX.XX.XX.XX
Status code 413 Payload Too Large

How to create a custom error page for the 413 status code

Creating your own 413 Payload Too Large error page is relatively easy with the web server "Apache" as well as with the web server "NGINX".

Apache Webserver

The web server "Apache" is one of the most popular web servers on the Internet. To create an own 413 Payload Too Large error page in "Apache", the following change must be made in the following file.

File: .htaccess
ErrorDocument 413 /errors/413.html

NGINX Webserver

Similar to the web server "Apache", "NGINX" is also widely used on the Internet. To create your own 413 Payload Too Large error page in "NGINX", the following change must be made in the following file.

File: sites-enabled/default
error_page 413 /413.html;
location = /413.html {
    root /usr/share/nginx/html;
    internal;
}

Browser compatibility of the 413 status code

Chrome no data
Edge no data
Firefox no data
Opera no data
Safari no data
Chrome Android no data
Firefox for Android no data
Opera Android no data
Safari on iOS no data
Internet no data
WebView Android no data

Constants in programming languages

HttpStatusCode.RequestEntityTooLarge
http.StatusRequestEntityTooLarge
Response::HTTP_REQUEST_ENTITY_TOO_LARGE
httplib.REQUEST_ENTITY_TOO_LARGE
http.client.REQUEST_ENTITY_TOO_LARGE
http.HTTPStatus.REQUEST_ENTITY_TOO_LARGE
:request_entity_too_large
Author: Tony Brüser
Author: Tony Brüser

Tony Brüser is an enthusiastic web developer with a penchant for HTTP status codes.

LinkedInGitHub