What 411 Length Required means

411 Length Required is rare in modern HTTP. The server is rejecting a request because it has a body but no Content-Length header (and the server does not support chunked transfer encoding for this endpoint). Most modern HTTP clients set Content-Length automatically, so 411 mostly shows up when handcrafting requests or using ancient libraries.

When servers should return it: Return 411 when your server cannot handle requests without a Content-Length and the client did not send one.

Common causes

  • Handcrafted HTTP request without Content-Length
  • Client streamed body without specifying length
  • Older HTTP/1.0 client

How to fix 411 Length Required

  • Add Content-Length header to the request
  • Or use Transfer-Encoding: chunked if the server supports it
  • Most modern HTTP libraries set this automatically

Example response

HTTP/2 411
content-type: text/plain
Content-Length header required

More references

For a one-page reference of all HTTP status codes, see the HTTP cheat sheet. For testing API responses, try the API Tester tool. For inspecting responses on the command line, the curl cheat sheet covers the most common flags.