HTTP 411 Length Required — Missing Content-Length Header
Warning4xx client error
Overview
HTTP 411 Length Required means the server refuses the request because the Content-Length header is missing and the server requires it.
Key Details
- Server requires the Content-Length header but the client did not send it
- Common with POST and PUT requests that have a request body
- Some servers and proxies require Content-Length for security and resource allocation
- Chunked transfer encoding (Transfer-Encoding: chunked) may not be accepted
- Load balancers and WAFs frequently enforce Content-Length requirements
Common Causes
- HTTP client not setting Content-Length header on POST/PUT requests
- Using chunked transfer encoding against a server that does not support it
- Proxy or WAF stripping the Content-Length header from requests
- Streaming request body without pre-calculating total size
Steps
- 1Add Content-Length header to your request matching the body size in bytes
- 2In curl, use -H 'Content-Length: N' or let curl calculate it automatically with -d
- 3If using chunked encoding, switch to buffered body with explicit Content-Length
- 4Check if a proxy or CDN is modifying request headers in transit
- 5For large uploads, check if the server supports chunked encoding or requires Content-Length
Tags
http411length-requiredcontent-lengthheader
More in 4xx Client Error
http-400-bad-requestHTTP 400 Bad Request — What It Means & How to Fix It
Errorhttp-401-unauthorizedHTTP 401 Unauthorized — What It Means & How to Fix It
Errorhttp-402-payment-requiredHTTP 402 Payment Required — What It Means & How to Fix It
Errorhttp-403-forbiddenHTTP 403 Forbidden — What It Means & How to Fix It
Errorhttp-404-not-foundHTTP 404 Not Found — What It Means & How to Fix It
Errorhttp-405-method-not-allowedHTTP 405 Method Not Allowed — What It Means & How to Fix It
ErrorFrequently Asked Questions
Servers use it to allocate memory, enforce size limits, and detect incomplete transmissions.