Skip to content

Request Header too large when saving constraints

🐛 Bug Report

Summary

Saving a constraint in Constrainify by using QPM backend API Call fails when the list of XPaths becomes too large, resulting in an HTTP 400 error due to exceeding the maxHttpHeaderSize limit in QPMs' Tomcat.

Steps to Reproduce

  1. Create a new constraint based on Regular Expression Check template.
  2. Choose LIDO Root as (Wrapper for an object record) element
  3. Choose language as property
  4. Save the constraint (the UI will report a 500)
  5. Check the logs of constrainify-core

What is the current bug behavior?

The QPM backend responds with a 400 – Bad Request error due to the request header exceeding the maximum allowed size (maxHttpHeaderSize="65536"). The constraint data, especially the large list of XPaths, results in a header too large for Tomcat to handle.

What is the expected correct behavior?

The constraint should be saved successfully.

Relevant Logs, Screenshots, or Gifs

ERROR: Got error response from QPM Backend with status code: 400 and content: b'<!doctype html><html lang="en"><head><title>HTTP Status 400 \xe2\x80\x93 Bad Request</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 400 \xe2\x80\x93 Bad Request</h1><hr class="line" /><p><b>Type</b> Exception Report</p><p><b>Message</b> Request header is too large</p><p><b>Description</b> The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).</p><p><b>Exception</b></p><pre>

Possible Fix or Suggested Solution

  • Increase the maxHttpHeaderSize for Tomcat in QPMs' Dockerfile. Possible drawbacks: 1) Increases request time for saving constraint 2) reduces performance
  • Introduce a new minimization component in the Constrainify controller layer (or a shared utility layer) that preprocesses the list of XPaths before sending them to the QPM backend. Possible drawbacks: Significant development effort

Additional Context

maxHttpHeaderSize is set in QPMs' Dockerfile to 65536, which is higher than default.