411 Length Required

The server refuses the request because it did not declare a Content-Length.

Status

HTTP/1.1 411 Length Required

Details

Some servers will not accept a body of unknown size. If a request arrives without Content-Length and without chunked transfer encoding, they answer 411 rather than reading an unbounded stream.

It appears mostly with hand-built HTTP clients, with scripts that stream a body from a pipe, and with older servers that do not accept chunked uploads.

Headers

Common causes

How to fix it

As the client

As the server

Examples

POST /upload HTTP/1.1
Host: api.example.com
Content-Type: application/octet-stream

(body with no declared length)

HTTP/1.1 411 Length Required

Specifications

RFC 9110 §15.5.12

See also