4xx
411 Length Required
The server requires a Content-Length header that was not included in the request.
What is HTTP 411?
This status code indicates that the server refuses to accept the request without a defined Content-Length header. The server needs to know the size of the request body before it can process it. This can occur when using chunked transfer encoding on servers that require knowing the full body size upfront. The client should add the Content-Length header and retry the request.
Defined in RFC 9110
Common Causes
- Sending a request body without a Content-Length header
- Using chunked transfer encoding on a server that requires an explicit content length
- HTTP client libraries that omit Content-Length for certain request methods
How to Fix
- Add a Content-Length header with the exact size in bytes of the request body
- Ensure your HTTP client library is configured to include Content-Length automatically
- If using streaming or chunked uploads, check if the server supports Transfer-Encoding: chunked