411 Length Required
4xx client error
The server refuses the request because it has no Content-Length header.
411 means the server wants to know the size of the body up front and won't accept a request without Content-Length — for example one sent with chunked transfer encoding. It mostly comes from older servers, some proxies, and endpoints that must know the size before accepting data.
| Class | 4xx Client Error |
|---|---|
| Retry? | No — change the request first |
| Cacheable by default | No — only with explicit Cache-Control |
| Response body | Allowed |
| Defined in | RFC 9110 §15.5.12 — 411 Length Required |
Example response
HTTP/1.1 411 Length Required
Content-Type: application/json
Content-Length: 27
{"error":"Length Required"}Common causes
- A POST or PUT sent with chunked transfer encoding to a server that doesn't support it.
- An empty-body POST sent without
Content-Length: 0.
How to fix it
- Send
Content-Length, includingContent-Length: 0for empty bodies. - Buffer the body before sending if your client streams it in chunks.
Send a 411 from your server
Express
res.status(411).json({ error: "Length Required" });Next.js route handler
return Response.json({ error: "Length Required" }, { status: 411 });Flask
return {"error": "Length Required"}, 411Go net/http
http.Error(w, "Length Required", http.StatusLengthRequired)
nginx
return 411;
Check what a URL returns
Print just the status line from the command line, or check a whole list of URLs at once, with their response headers, in the HTTP Status Checker.
curl -sI https://example.com/your-path | head -n 1
Frequently asked questions
Why does my empty POST get 411?
Some servers and proxies require Content-Length even when there's no body. Send Content-Length: 0 or an explicit empty body.
Headers used with 411
Related status codes