diff --git a/nifi-commons/nifi-properties/src/main/java/org/apache/nifi/util/NiFiProperties.java b/nifi-commons/nifi-properties/src/main/java/org/apache/nifi/util/NiFiProperties.java index beb222a496..b211b71250 100644 --- a/nifi-commons/nifi-properties/src/main/java/org/apache/nifi/util/NiFiProperties.java +++ b/nifi-commons/nifi-properties/src/main/java/org/apache/nifi/util/NiFiProperties.java @@ -176,6 +176,7 @@ public abstract class NiFiProperties { public static final String WEB_HTTPS_NETWORK_INTERFACE_PREFIX = "nifi.web.https.network.interface."; public static final String WEB_WORKING_DIR = "nifi.web.jetty.working.directory"; public static final String WEB_THREADS = "nifi.web.jetty.threads"; + public static final String WEB_MAX_HEADER_SIZE = "nifi.web.max.header.size"; // ui properties public static final String UI_BANNER_TEXT = "nifi.ui.banner.text"; @@ -232,6 +233,7 @@ public abstract class NiFiProperties { public static final Integer DEFAULT_REMOTE_INPUT_PORT = null; public static final Path DEFAULT_TEMPLATE_DIRECTORY = Paths.get("conf", "templates"); public static final int DEFAULT_WEB_THREADS = 200; + public static final String DEFAULT_WEB_MAX_HEADER_SIZE = "16 KB"; public static final String DEFAULT_WEB_WORKING_DIR = "./work/jetty"; public static final String DEFAULT_NAR_WORKING_DIR = "./work/nar"; public static final String DEFAULT_COMPONENT_DOCS_DIRECTORY = "./work/docs/components"; @@ -584,6 +586,10 @@ public abstract class NiFiProperties { return sslPort; } + public String getWebMaxHeaderSize() { + return getProperty(WEB_MAX_HEADER_SIZE, DEFAULT_WEB_MAX_HEADER_SIZE); + } + public int getWebThreads() { return getIntegerProperty(WEB_THREADS, DEFAULT_WEB_THREADS); } diff --git a/nifi-docs/src/main/asciidoc/administration-guide.adoc b/nifi-docs/src/main/asciidoc/administration-guide.adoc index 12a50a9464..432812804e 100644 --- a/nifi-docs/src/main/asciidoc/administration-guide.adoc +++ b/nifi-docs/src/main/asciidoc/administration-guide.adoc @@ -3004,6 +3004,7 @@ nifi.web.https.network.interface.eth1=eth1 + Providing three total network interfaces, including `nifi.web.https.network.interface.default`. |nifi.web.jetty.working.directory|The location of the Jetty working directory. The default value is `./work/jetty`. |nifi.web.jetty.threads|The number of Jetty threads. The default value is `200`. +|nifi.web.max.header.size|The maximum size allowed for request and response headers. The default value is 16 KB. |==== === Security Properties diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/pom.xml b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/pom.xml index 1333a9ce2d..3e6a65da85 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/pom.xml +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/pom.xml @@ -131,6 +131,7 @@ ./work/jetty 200 + 16 KB diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/conf/nifi.properties b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/conf/nifi.properties index 624f2f1883..49f08ada2a 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/conf/nifi.properties +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/conf/nifi.properties @@ -136,6 +136,7 @@ nifi.web.https.port=${nifi.web.https.port} nifi.web.https.network.interface.default=${nifi.web.https.network.interface.default} nifi.web.jetty.working.directory=${nifi.jetty.work.dir} nifi.web.jetty.threads=${nifi.web.jetty.threads} +nifi.web.max.header.size=${nifi.web.max.header.size} # security properties # nifi.sensitive.props.key= diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-jetty/src/main/java/org/apache/nifi/web/server/JettyServer.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-jetty/src/main/java/org/apache/nifi/web/server/JettyServer.java index be737c5635..bd72c81998 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-jetty/src/main/java/org/apache/nifi/web/server/JettyServer.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-jetty/src/main/java/org/apache/nifi/web/server/JettyServer.java @@ -30,6 +30,7 @@ import org.apache.nifi.documentation.DocGenerator; import org.apache.nifi.lifecycle.LifeCycleStartException; import org.apache.nifi.nar.ExtensionManager; import org.apache.nifi.nar.ExtensionMapping; +import org.apache.nifi.processor.DataUnit; import org.apache.nifi.security.util.KeyStoreUtils; import org.apache.nifi.services.FlowService; import org.apache.nifi.ui.extension.UiExtension; @@ -109,7 +110,6 @@ public class JettyServer implements NiFiServer { private static final Logger logger = LoggerFactory.getLogger(JettyServer.class); private static final String WEB_DEFAULTS_XML = "org/apache/nifi/web/webdefault.xml"; - private static final int HEADER_BUFFER_SIZE = 16 * 1024; // 16kb private static final FileFilter WAR_FILTER = new FileFilter() { @Override @@ -578,8 +578,9 @@ public class JettyServer implements NiFiServer { private void configureConnectors(final Server server) throws ServerConfigurationException { // create the http configuration final HttpConfiguration httpConfiguration = new HttpConfiguration(); - httpConfiguration.setRequestHeaderSize(HEADER_BUFFER_SIZE); - httpConfiguration.setResponseHeaderSize(HEADER_BUFFER_SIZE); + final int headerSize = DataUnit.parseDataSize(props.getWebMaxHeaderSize(), DataUnit.B).intValue(); + httpConfiguration.setRequestHeaderSize(headerSize); + httpConfiguration.setResponseHeaderSize(headerSize); if (props.getPort() != null) { final Integer port = props.getPort();