HTTPfy

411 Length Required

The server requires a Content-Length header for this request.

411 at a glance

Code
411
Name
Length Required
Class
4xx Client error
Status
IANA-registered standard code
Defined in
RFC 9110, Section 15.5.12
Cacheable by default
No by default. Caches store it only when the response carries explicit freshness (Cache-Control max-age, s-maxage or Expires).

What 411 means

411 Length Required means the server refuses a request body without a defined length. The client must send Content-Length; some servers do not accept Transfer-Encoding: chunked request bodies.

What typically causes a 411

  • POST or PUT with no body and no Content-Length: 0 (some servers and Google APIs insist on it).
  • Chunked uploads to servers or proxies that do not support chunked request bodies.
  • curl -X POST without -d, which sends no Content-Length.

Fix it on the server

  • Accept chunked bodies if you can; nginx supports chunked request bodies since 1.3.9.

Fix it as a client or visitor

  • Send Content-Length: 0 for empty POSTs, or buffer the body so the length is known.

Headers that go with 411

HeaderRole
Content-LengthThe header the server wants.

Example response

HTTP/1.1 411 Length Required
Content-Type: text/html
Connection: close

Opens the HTTP headers tool with your URL filled in; it shows the status line and headers of every redirect hop.