API Gateway: HTTP "400 Bad Request" Error Shown When the Request Header is Too Large

Document ID : KB000042986
Last Modified Date : 14/02/2018
Show Technical Document Details

Solution

Introduction

When an HTTP request is sent to the API Gateway with a request header size of larger than 8000 bytes, the Gateway will present a "400 Bad Request" error. The Gateway, by default, will only accept a request header size of 8000 bytes (8 KB). To work around this issue, the Gateway can be told to accept request headers larger than 8000 bytes.

Resolution

To increase the size the Gateway will accept for a request header, follow the instructions below.
  1. Open up Policy Manager.
  2. Go to Tasks --> Manage Listen Ports.
  3. In the Manage Listen Ports window, select the port you want to change and click the Properties button.
    Manage Listen Ports window
  4. In the Listen Port Properties window, select the Advanced tab, then the Add button to add an advanced property to the port.
  5. In the New Property window, configure it as follows then click the OK button:
    • Property Name: maxHttpHeaderSize
    • Value: 16000
  6. Click the OK button again on the Listen Port Properties window to save the changes to the listen port.
  7. Click the Close button on the Manage Listen Ports window.
After the steps above are completed, the Listen Port Properties (Advanced tab) should look similar to the image below:
Listen Port Properties window
Notes:
  • The property to add is on a per-port basis.
  • The property name is case-sensitive.
  • The value for maxHttpHeaderSize noted above is in bytes.
  • The value for maxHttpHeaderSize noted above can be any number you want (in bytes), but should be large enough for the Gateway to accept the request header sizes being received.