411 Length Required
The server refuses the request because it did not include a Content-Length header.
At a glance
- Status code
- 411 Length Required
- Class
- 4xx, client error, the request itself is the problem
- Defined in
- RFC 9110
- Cacheable by default
- no
- Response body
- Optional.
In detail
The server wants to know the body size before reading it, usually so it can reject an oversized upload without buffering it.
Servers should accept chunked transfer encoding instead of demanding a length. Requiring Content-Length rules out streaming a body whose size is not known in advance.
Either set Content-Length explicitly or buffer the body so the client library can compute it. Streaming clients have to buffer.
Examples
HTTP/1.1 411 Length Required
Content-Length: 0Things that catch people out
- HTTP/2 and HTTP/3 do not use Transfer-Encoding: chunked, so a 411 there means the framework genuinely wants the header.
- Sending both Content-Length and Transfer-Encoding is a request smuggling vector and many proxies reject it outright with 400.
Try it: HTTP Request Builder
Build a request with any method, headers and body, send it, and read the status line the server returns.
HTTP Request Builder
LOCAL · Browser-OnlyBuild and test HTTP requests with custom headers and body
Authentication
Headers
Generate Code
curl -X GET 'https://api.example.com/endpoint' \
-H 'Content-Type: application/json'Showing a sample URL. Enter your endpoint above to update the snippet.
Related HTTP status codes
All http status codes →400 Bad Request
The server refused the request because it was malformed. The client must change something before retrying, because repeating the same bytes will fail.
413 Content Too Large
The request body is larger than the server is willing to process. Formerly called Payload Too Large.
501 Not Implemented
The server does not support the functionality required to fulfil the request, typically an unrecognised request method.
412 Precondition Failed
A conditional header on the request, such as If-Match or If-Unmodified-Since, evaluated to false, so the server did not perform the action.
414 URI Too Long
The request URL is longer than the server will accept. Almost always caused by putting data in a query string that belongs in a request body.
415 Unsupported Media Type
The server refuses the request because the body is in a format it cannot handle, as declared by Content-Type.
Tools for this
- HTTP Request Builder Free online HTTP request builder - build and test HTTP requests with custom headers and body
- HTTP Headers Checker Free online HTTP headers checker - view HTTP response headers for any URL