Skip to the content

411 Length Required

The server refuses the request because it has a body and no Content-Length header that says how long the body is.

Class
4xx Client error. The request is the problem: a wrong address, missing credentials, data the server can't accept.
Defined in
RFC 9110

Share this tool:TwitterFacebookLinkedInWhatsAppEmail

What causes it

When a request with a body arrives without Content-Length and the server won't take a body of unknown size. That mostly happens when the client sends the body in chunks, with Transfer-Encoding: chunked, to a server or proxy that doesn't accept that.

What to do about it

Send the length. Most HTTP libraries add Content-Length themselves when they know the size in advance, so hand them the body as a string or a buffer and not as a stream. A POST or PUT with an empty body may need an explicit Content-Length: 0.

Not to be confused with

413 Content Too LargeThe length is known, and it is too much.
400 Bad RequestSomething else in the request is malformed.

All codes are on the list of HTTP status codes, which can be searched by number and by word.

See all 12