
HTTP 411 Length Required is a client error status code indicating the server refused to process the request because the Content-Length header was missing. The server requires this header to know how many bytes of data are being transmitted in the request body before it will fulfill the request.
A server returns a 411 when a client sends a request — most commonly a POST or PUT request — without including a Content-Length header. It can also occur when the declared Content-Length value does not accurately reflect the actual size of the request body being sent.
To fix a 411 error, add a Content-Length header to your request and set its value to the exact byte size of the request body. Many HTTP client tools such as curl and Postman will set this header automatically when you provide a request body, so switching to one of these tools can resolve the issue without manual header management.
When using chunked transfer encoding, the Content-Length header is intentionally omitted from the overall request, and instead the length of each individual chunk is included in hexadecimal format at the start of that chunk. Some servers do not support chunked encoding and will return a 411 in this case, requiring you to send the full body with a Content-Length header instead.
Both are 4xx client error codes, meaning the problem originates from the request rather than the server. HTTP 400 Bad Request is a general error for malformed or invalid requests, while HTTP 411 is a specific error indicating only that the Content-Length header is absent. If your request body is present but the header is missing, you will receive a 411 rather than a 400.
Requiring clients to declare payload size upfront allows the server to allocate resources appropriately and helps protect against certain forms of request abuse. Without a known content length, a server cannot reliably determine when a request body ends, which can create processing and security issues.