HTTP/4xx (Client Error)
411 Length Required
The server refuses the request because it requires a Content-Length header.
❓ Why does this happen?
POST/PUT request sent with chunked encoding or no body length to a server that requires an explicit length.
✅ How to fix it
Send a Content-Length header (or an empty body with Content-Length: 0 for bodiless POST requests).
Return or handle 411 in your stack
// app/api/resource/route.ts
export function GET() {
return Response.json(
{ error: "Length Required", status: 411 },
{
status: 411
}
);
}Live 411 mock endpoint
Point your app, tests, or retry logic at this free public URL to reproduce a real 411 response (CORS enabled, optional ?delay=ms up to 5000).
https://castov.com/api/mock/411Frequently Asked Questions
What does HTTP Status 411 mean?
Why am I getting a 411 status code?
How do I fix a 411 Length Required error?
How can I test how my app handles a 411 response?
Other 4xx status codes
Browse the full HTTP status codes directory or troubleshoot terminal errors in the Error Fix Encyclopedia.