HTTP 411 Length Required

An unmeasured roll of paper waits beside a parcel sizing guide

HTTP 411 Length Required means the recipient refuses the request without a defined Content-Length. A service may require a length before accepting a body.

How a streamed upload encounters 411

An HTTP/1.1 client can send a stream using chunked transfer framing when it does not know the final length. A gateway or backend that requires a known length can reply with 411. Buffering a suitable payload or sending a known-size file allows the client library to compute its length correctly.

Check the request at the receiving hop

Read the request metadata on both sides of the intermediary and identify where Content-Length is expected. Let the HTTP library calculate the byte count so the framing matches the body. If the server rejects a body whose length exceeds a configured limit, see 413 Content Too Large.

Compare a known-size file with a stream

A client sending a four-byte file over HTTP/1.1 might include Content-Length: 4. The same client streaming generated output can use Transfer-Encoding: chunked because it has no size in advance. If only the streamed request returns HTTP 411, check whether the API requires a declared length and which hop applies the requirement. Supply a file or bounded buffer to the client library so it can compute the correct header even when the body contains multibyte text.

Check framing where the request is rejected

In a common setup, the gateway talks one HTTP version to the client and another to the backend. The request metadata your client records can therefore differ from what the backend sees. Compare the status and body size at each hop using a small upload to a route you control. If the gateway issues the 411 before contacting the backend, the gateway’s upload policy is the first place to check. If the backend logs the error, check which request body modes it supports before adjusting the proxy.

RFC 9110.

All HTTP status codes · All proxy testing guides · Open the proxy tester