411 Length Required HTTP Status Code


HTTP status code 411, also known as "Length Required," is a client error response code indicating that the server refuses to accept the request without a defined Content-Length header. This header is crucial in certain situations where the server needs to know the size of the data being sent in the request body ahead of time for processing or validation purposes. This requirement is often enforced for POST or PUT requests, where the body of the request contains data that the server needs to process.

The server might need the Content-Length header for various reasons, including:

  1. Resource allocation: The server might need to allocate appropriate resources based on the size of the incoming data.
  2. Security: To prevent certain types of denial-of-service (DoS) attacks, where an attacker might try to send a request with a very large body to exhaust server resources.
  3. Protocol compliance: Certain server configurations or proxy servers might enforce the presence of the Content-Length header to comply with HTTP/1.1 specifications.

To resolve this error, the client must include the Content-Length header in the request with the size of the request body's data in bytes. This allows the server to validate the size of the incoming request before processing it, ensuring that it meets the server's requirements for handling the request.


411 Length Required

Common Causes

Here are the primary reasons this error might occur:

  1. Content-Length Header Missing: The most straightforward cause of a 411 error is when a request is made to a server that requires the Content-Length header, but the request does not include it. The Content-Length header is crucial as it informs the server of the size of the request body.

  2. Server Configuration: Some servers or specific resources on a server might be configured to reject requests without a Content-Length header. This configuration could be for security reasons, to prevent certain types of attack vectors, or to ensure that the server can allocate appropriate resources for handling the request.

  3. RESTful APIs or Web Services: Certain web services, particularly those that are RESTful, might require every POST or PUT request to include a Content-Length header. If a client fails to include this header in requests that modify resources, the server might respond with a 411 error.

  4. Client-Side Issues: In some cases, the way a client application or a browser is configured or implemented might prevent it from correctly adding the Content-Length header to requests that need it. This could be due to programming errors, incorrect API usage, or misconfiguration.

  5. Proxy Servers or Intermediaries: Sometimes, proxy servers or other intermediary network devices might strip out headers, including the Content-Length header, from requests. This could result in the server receiving a request without the required header, leading to a 411 error.

  6. HTTP/1.1 Protocol Requirement: The HTTP/1.1 protocol makes it mandatory for requests that include a message body to have a Content-Length header. If this requirement is not met, the server is expected to respond with a 411 status code. This is part of the protocol's specification to ensure that servers can properly interpret and handle the request body.

Resolving a 411 error typically involves ensuring that the client includes a valid Content-Length header in the request. In some cases, it might also require server-side adjustments or configuration changes to handle requests without such a header, though this is less common and might not be recommended depending on the context and security requirements.

Browser Support

The following table will show you the current browser support for the 411 Length Required HTTP status code.

Edge Chrome Firefox Opera Safari
Tablets / Mobile
Chrome Firefox Opera Safari Samsung Webview

Last updated by CSSPortal on: 1st April 2024