More
More
411 Length Required
The server needs a Content-Length header and the request had none.
- Code
411- Reason phrase
- Length Required
- Class
- 4xx Client error
- Defined in
- RFC 9110 section 15.5.12
- Cacheable by default
- No
What it means
Client error: the problem lies with the request. Repeating it unchanged will normally fail again.
Common causes. Some clients sending a POST body without stating its length.
What to do. Send the Content-Length header.
How clients and crawlers treat it
Google Search. Like every 4xx except 429, it tells Google the content does not exist: an indexed URL is removed from the index, and a new one is not processed. Crawl frequency for the URL gradually drops. Source: Google Search Central, How HTTP status codes, and network and DNS errors affect Google Search.
Caching. Not cacheable by default (RFC 9110 section 15.1 does not list it). A cache stores it only when the response says so with Cache-Control or Expires.
Example response
HTTP/1.1 411 Length Required Content-Type: text/plain; charset=utf-8 Length Required
How to send 411
location /example {
return 411;
}
RewriteEngine On RewriteRule ^example$ - [R=411,L]
http_response_code(411); echo 'Length Required'; exit;
res.writeHead(411, { 'Content-Type': 'text/plain' });
res.end('Length Required');
# in a view function return 'Length Required', 411
Change the paths to suit. In nginx, add_header needs always to apply to error responses.
Related codes
- 410GoneThe resource was deliberately removed and will not come back.
- 412Precondition FailedA condition in the request headers, such as If-Match, was not met.
- 409ConflictThe request conflicts with the current state of the resource.
- 413Content Too LargeThe request body is bigger than the server allows.
All status codes · All 4xx codes
Names and numbers from the IANA HTTP Status Code Registry. Google Search behaviour as documented by Google Search Central.