411 Length Required

The HTTP 411 Length Required status code is a client error returned by the server to indicate the request lacks a required Content-Length header field.

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.

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

Takeaway

The 411 Length Required status code is a client error indicating the Content-Length header field is mandatory for this request. The client needs to resubmit the request with a valid message body length.

See also

Last updated: March 4, 2026