SiteError.comYour friendly guide to HTTP status codes
Status CodesBlog
  1. Home
  2. 4xx Client Error
  3. 411 Length Required

411 Length Required

📏
411
Length Required
!
?

Example HTTP Response

HTTP Response
HTTP/1.1 411 Length Required
Content-Type: application/json

{"error": "Content-Length header required"}
Common Causes
  • Missing Content-Length header
  • Chunked encoding not supported
  • Server requires content length for processing
Technical Details

What does this mean?

How much are you sending? The server needs to know the size upfront. No mystery packages allowed!

Technical Definition

The server refuses to accept the request without a defined Content-Length header.

RFC Says

"The 411 (Length Required) status code indicates that the server refuses to accept the request without a defined Content-Length. The client MAY repeat the request if it adds a valid Content-Length header field containing the length of the message body in the request message."

Plain English:

411 means 'You need to tell me how big your request body is by including a Content-Length header.' This is rarely needed in modern applications since most HTTP clients automatically include Content-Length.

Common Misinterpretation

You almost never need to return 411 in modern APIs. Most HTTP libraries handle Content-Length automatically. Only use 411 if you're building low-level HTTP infrastructure that specifically requires Content-Length for chunked transfer encoding decisions.

View RFC Documentation
Code Snippets

Ready-to-use code for returning this HTTP status in your application:

Node.js
// Express.js
app.get('/example', (req, res) => {
  res.status(411).json({
    error: 'Length Required',
    message: 'Your error message here'
  });
});

// Native HTTP
const http = require('http');

http.createServer((req, res) => {
  res.writeHead(411, { 'Content-Type': 'application/json' });
  res.end(JSON.stringify({
    error: 'Length Required',
    message: 'Your error message here'
  }));
}).listen(3000);

411 Length Required FAQ

What causes a 411 Length Required error?

Missing Content-Length header. Chunked encoding not supported. Server requires content length for processing.

410 Gone412 Precondition Failed

Popular Status Codes

  • 200 OK
  • 301 Moved Permanently
  • 302 Found
  • 400 Bad Request
  • 401 Unauthorized
  • 403 Forbidden
  • 404 Not Found
  • 500 Internal Server Error
  • 502 Bad Gateway
  • 503 Service Unavailable

Compare Codes

  • 401 vs 403
  • 301 vs 302
  • 404 vs 410
  • 500 vs 502
  • Compare any codes →

Categories

  • Informational
  • Success
  • Redirection
  • Client Error
  • Server Error
  • NGINX
  • Cloudflare
  • AWS ELB
  • Microsoft IIS

Tools

  • Cheat Sheet
  • Status Code Quiz
  • URL Checker
  • API Playground
  • Blog

© 2026 SiteError.com. All rights reserved.