How to Resolve HTTP 411 Length required error, for ICDM Public APIs
search cancel

How to Resolve HTTP 411 Length required error, for ICDM Public APIs

book

Article ID: 377379

calendar_today

Updated On:

Products

Endpoint Security Complete

Issue/Introduction

API Error 411 is related to content length. 

Environment

 

 

Cause

The GCP load balancers not allowing PUT/POST requests without the content-length headers for HTTP 1.0 or 1.1 after Endpoint Security Maintenance.

Endpoint Security Maintenance (US Region) September 12, 2024


For methods like POST and PUT, the Content-Length header is used to specify the size of the request body. If this header is not included, the server cannot determine how much data it needs to read. This leads to the 411 response. This header should be included even if the request body is empty.

Resolution

Upgraded to leverage HTTP 2.0 or Include the Content-Length Header in request.

Most modern HTTP 2.0 libraries handle the Content-Length header automatically. Ensure that your client library or tool is correctly configured or updated.

Ensure that POST and PUT requests include the Content-Length header. This header should accurately reflect the size of the request body in bytes and should be included even if the request body is empty.

Example:

curl --location --request POST 'https://api.sep.securitycloud.symantec.com/v1/oauth2/tokens' \
--header 'Accept: application/json' \
--header 'Authorization: Basic <Token>' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Content-Length: 0'

Additional Information

GCP LB Documentation:

 "There's a non-chunked body and no content length specified" in the "Illegal request and response handling" section of the article below.

See Google article:
External Application Load Balancer overview