HTTP 411 Length Required
The server requires a Content-Length header in the request.
4xx Client Error
411
Length Required
Description
The 411 Length Required status code indicates that the server refuses to accept the request without a defined Content-Length. The client may repeat the request if it adds a valid Content-Length header field containing the length of the message body in the request message. This status code is used by servers that require knowing the size of the request body before processing it, often for resource allocation or to prevent excessively large uploads.
When Is It Used?
Returned when the server needs a Content-Length header but the client did not provide one. This can happen with chunked transfer encoding on servers that do not support it, or when uploading data without specifying the content length.
Example Response
HTTP/1.1 411 Length Required
Content-Type: application/json
{"error": "length_required", "message": "Content-Length header is required"}