411 Length Required

When a request omits the mandatory Content-Length header, the server responds with 411 Length Required.

Usage

When the 411 Length Required error message is received, the request must be resubmitted with the Content-Length header included. HTTP requests generally use this header to specify the length of the message body, though not always. For example, when the Transfer-Encoding header field is included and set to chunked, the Content-Length header field is not required.

If the client is sending a stream of data and this status is returned, the data must be sent in size-specified blocks instead.

SEO impact

Search engines like Google will not index a URL with a 411 Length Required response status. URLs previously indexed will be removed from search results. Pages returning this code do not waste crawl budget.

Example

The client attempts to send a file but the server denies the request with 411 Length Required because the message body length is not specified.

Request

PUT /docs HTTP/1.1
Host: www.example.re
Content-Type: application/pdf

<PDF file included as message body>

Response

HTTP/1.1 411 Length Required

How to fix

Add a Content-Length header with the exact byte count of the request body. Most HTTP client libraries calculate this value automatically when sending a string or buffer. Verify the library is not stripping the header or setting the value to zero.

When the request uses chunked Transfer-Encoding, the target server does not accept chunked bodies. Buffer the full payload first, measure the byte length, and send the body with a Content-Length header instead.

Proxies and firewalls sometimes strip or modify headers in transit. If the client sends Content-Length correctly but the server still returns 411, inspect the request at the server side to confirm the header arrives intact.

In curl, the -d flag sets Content-Length automatically. For Transfer-Encoding: chunked with curl, use -H "Transfer-Encoding: chunked", but only when the server supports chunked transfers.

Server-side, this status is often returned by strict configurations or older HTTP/1.0 servers not supporting chunked encoding. The server administrator sets this policy deliberately, and the fix is always on the client side.

411 in API testing tools

Tools like Postman and curl handle the Content-Length header automatically for most request types. A 411 error in Postman typically occurs when sending an empty body on a POST or PUT request without selecting a body type. Choosing a body format (raw, form-data, or x-www-form-urlencoded) causes Postman to set the Content-Length header correctly.

Code references

.NET

HttpStatusCode.LengthRequired

Rust

http::StatusCode::LENGTH_REQUIRED

Rails

:length_required

Go

http.StatusLengthRequired

Symfony

Response::HTTP_LENGTH_REQUIRED

Python3.5+

http.HTTPStatus.LENGTH_REQUIRED

Java

java.net.HttpURLConnection.HTTP_LENGTH_REQUIRED

Apache HttpComponents Core

org.apache.hc.core5.http.HttpStatus.SC_LENGTH_REQUIRED

Angular

@angular/common/http/HttpStatusCode.LengthRequired

See also

Last updated: April 4, 2026