411 Length Required
HTTP response status code 411 Length Required is a client error that is returned by the server to indicate that the request cannot be completed because the Content-Length HTTP header field is absent.
When the 411 Length Required error message is received, it means that the request must be resubmitted with the Content-Length HTTP header included. HTTP requests generally use this header to specify the length of the message body, although it is not always required. For example, when the Transfer-Encoding HTTP header field is included and set to
chunked, the Content-Length HTTP header field is not required.
If the client is sending a stream of data and this status is returned, it will have to send the data in size-specified blocks, instead.
Search engines like Google will not index a URL with 411 Length Required response status, and consequently, URLs that have been indexed in the past but are now returning this HTTP status code will be removed from the search results.
In the example, the client attempts to send a file but the server denies the HTTP request with 411 Length Required because it wants to know how much data shall be included in the message body before saving it locally.
PUT /docs HTTP/1.1 Host: www.example.ai Content-Type: applications/pdf <PDF file included as message body>
HTTP/1.1 411 Length Required
Apache HttpComponents Core
The 411 Length Required status code is a client error presented to inform the client that the Content-Length HTTP Header field is mandatory, yet absent. The client can resubmit the request with a valid message body length.