4xx Client Errors
HTTP 411 Length Required
The server requires a Content-Length header in the request.
When is 411 used?
- Server requiring exact content length before accepting body
How to handle a 411 response
Inspect the request — URL, method, headers, credentials, and body. Retrying the same request unchanged will usually fail again; 429 is the exception, where you should wait for the Retry-After period.
Check the status code a URL returns from the command line:
curl -s -o /dev/null -w "%{http_code}\n" https://example.comHow to return 411 from your server
Node.js (Express)
res.status(411).json({ message: 'Length Required' });Python (Flask)
return {"message": "Length Required"}, 411Go (net/http)
w.WriteHeader(411)Frequently Asked Questions
What does HTTP 411 mean?
411 Length Required: The server requires a Content-Length header in the request.
Is 411 an error?
Yes. 411 is in the 4xx Client Errors class. Client errors: the request is malformed, unauthorized, or targets something that does not exist.