This is an automated email from the ASF dual-hosted git repository.
liaoxin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new a6043b5c836 [fix](http) Fix jetty_server_max_http_header_size not
applied in Jetty 12 (#61197)
a6043b5c836 is described below
commit a6043b5c8368ef2c2a30ece1115710d1543a47ca
Author: Xin Liao <[email protected]>
AuthorDate: Fri Mar 13 10:39:24 2026 +0800
[fix](http) Fix jetty_server_max_http_header_size not applied in Jetty 12
(#61197)
## Problem
HTTP 431 "Request Header Fields Too Large" error occurs when sending
requests with large headers (>8KB) to FE, even though
`jetty_server_max_http_header_size` is configured to 10MB.
This issue appears in cloud-4.1.2 (Jetty 12 + Spring Boot 3) but not in
cloud-4.0.10 (Jetty 9 + Spring Boot 2).
## Root Cause
In Jetty 12 with Spring Boot 3, the `server.max-http-header-size`
property does not automatically apply to custom `HttpConfiguration`
objects created in `WebServerFactoryCustomizer`. The default 8KB limit
remains in effect.
## Solution
Explicitly set `requestHeaderSize` on all server connectors in
`WebServerFactoryCustomizerConfig` by adding a server customizer that
configures the `HttpConfiguration` for each connector.
## Testing
- Added regression test `test_large_http_header.groovy` that verifies
100KB headers are accepted
- Verified before fix: HTTP 431 error with large headers
- Verified after fix: HTTP 200 success with large headers
---
.../config/WebServerFactoryCustomizerConfig.java | 15 ++++++++
.../suites/http_p0/test_large_http_header.groovy | 44 ++++++++++++++++++++++
2 files changed, 59 insertions(+)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/httpv2/config/WebServerFactoryCustomizerConfig.java
b/fe/fe-core/src/main/java/org/apache/doris/httpv2/config/WebServerFactoryCustomizerConfig.java
index fc24bf1bd27..ead380b260e 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/httpv2/config/WebServerFactoryCustomizerConfig.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/httpv2/config/WebServerFactoryCustomizerConfig.java
@@ -40,6 +40,21 @@ public class WebServerFactoryCustomizerConfig implements
WebServerFactoryCustomi
@Override
public void customize(ConfigurableJettyWebServerFactory factory) {
+ // Set HTTP header size for all connectors
+ factory.addServerCustomizers(server -> {
+ for (org.eclipse.jetty.server.Connector connector :
server.getConnectors()) {
+ if (connector instanceof ServerConnector) {
+ ServerConnector serverConnector = (ServerConnector)
connector;
+ HttpConnectionFactory httpFactory =
+
serverConnector.getConnectionFactory(HttpConnectionFactory.class);
+ if (httpFactory != null) {
+ HttpConfiguration httpConfig =
httpFactory.getHttpConfiguration();
+
httpConfig.setRequestHeaderSize(Config.jetty_server_max_http_header_size);
+ }
+ }
+ }
+ });
+
((JettyServletWebServerFactory) factory).addServerCustomizers(server
-> {
WebAppContext context = server.getDescendant(WebAppContext.class);
if (context != null) {
diff --git a/regression-test/suites/http_p0/test_large_http_header.groovy
b/regression-test/suites/http_p0/test_large_http_header.groovy
new file mode 100644
index 00000000000..89cf1af4b72
--- /dev/null
+++ b/regression-test/suites/http_p0/test_large_http_header.groovy
@@ -0,0 +1,44 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+suite("test_large_http_header", "p0") {
+ def feHost = context.config.feHttpAddress
+ def (host, port) = feHost.split(":")
+
+ // Test with large HTTP header (100KB)
+ def largeHeaderValue = "x" * (100 * 1024)
+
+ def url = "http://${host}:${port}/api/health"
+
+ try {
+ def connection = new URL(url).openConnection()
+ connection.setRequestMethod("GET")
+ connection.setRequestProperty("X-Large-Header", largeHeaderValue)
+ connection.setConnectTimeout(5000)
+ connection.setReadTimeout(5000)
+
+ def responseCode = connection.getResponseCode()
+
+ // Should not return 431 (Request Header Fields Too Large)
+ assertTrue(responseCode != 431, "Should not return 431 error with
large header")
+
+ logger.info("Response code: ${responseCode}")
+ } catch (Exception e) {
+ logger.error("Test failed with exception: ${e.message}")
+ throw e
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]