Skip to main content
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/411

Frequently Asked Questions

What does HTTP Status 411 mean?
The server refuses the request because it requires a Content-Length header.
Why am I getting a 411 status code?
POST/PUT request sent with chunked encoding or no body length to a server that requires an explicit length.
How do I fix a 411 Length Required error?
Send a Content-Length header (or an empty body with Content-Length: 0 for bodiless POST requests).
How can I test how my app handles a 411 response?
Send a request to https://castov.com/api/mock/411 — it returns a real 411 Length Required response with CORS enabled. Add ?delay=2000 to simulate a slow server.

Other 4xx status codes

Browse the full HTTP status codes directory or troubleshoot terminal errors in the Error Fix Encyclopedia.