When you see this status
- Client sends POST/PUT without Content-Length header
- Client sends request with Content-Length: 0
- Chunked transfer encoding is not supported
Common causes
- Missing Content-Length header in request
- Client incorrectly assumes server supports chunked encoding
- Misconfigured HTTP client libraries
How to debug it
- Verify request includes Content-Length header
- Check if server supports chunked transfer encoding
- Inspect client code for header omission
- Test with curl: curl -v -H 'Content-Length: 0' http://example.com
Return this code in your framework
Express (Node.js)
res.status(411).send('Length Required');
FastAPI (Python)
@app.post('/')
def root(request: Request):
return Response(status_code=411, content='Length Required')
NestJS
@Get()
getData(@Res() res: Response) {
res.status(411).send('Length Required');
}
Go (net/http)
w.WriteHeader(http.StatusLengthRequired)
w.Write([]byte("Length Required"))
About HTTP 411
HTTP status code 411 Length Required is part of the
4xx Client Error family. Server refuses request because Content-Length header is missing or zero. Understanding it is essential for
backend engineers, API designers, and anyone debugging integrations between services.
The Qaynaq Labs HTTP Status Code Explainer covers all standard codes with practical guidance:
what triggers them, how to debug them in production, and exactly how to return them from common
frameworks. Each code page is hand-curated and verified.