MULTIPART_MAX_ENTITY_SIZE does not fallback to MAX_ENTITY_SIZE as documented

32 views
Skip to first unread message

Allan BURDAJEWICZ

unread,
Jan 28, 2026, 1:10:26 AMJan 28
to Undertow Dev
Hello Team,

After upgrading our project from Undertow 2.3.20 to 2.3.22, we were facing issues with the multipart max entity size:

io.undertow.server.RequestTooBigException: UT000020: Connection terminated as request was larger than 2097152

It lead us to the change made to the default in https://github.com/undertow-io/undertow/pull/1856

While we were adjusting the settings for this we noticed that line in the javadoc at https://github.com/undertow-io/undertow/blob/2.3.22.Final/core/src/main/java/io/undertow/UndertowOptions.java#L49:

If this is not specified it will be the same as {@link #MAX_ENTITY_SIZE}.

However this does not seem to be true. We are using Spring boot and the following customizer that set MAX_ENTITY_SIZE definitely does not solve our problem for Multipart:

@Bean
  public WebServerFactoryCustomizer<UndertowServletWebServerFactory>
      undertowMultipartMaxEntitySizeCustomizer(ServerProperties serverProperties) {

    long maxSize = serverProperties.getUndertow().getMaxHttpPostSize().toBytes();

    return factory ->
        factory.addBuilderCustomizers(
            builder -> {
              LOG.info("Applying MAX_ENTITY_SIZE={} to Undertow builder", maxSize);
              builder.setServerOption(UndertowOptions.MAX_ENTITY_SIZE, maxSize);
            });
  }


We must set the MULTIPART_MAX_ENTITY_SIZE which then solve our problem with multipart:

  @Bean
  public WebServerFactoryCustomizer<UndertowServletWebServerFactory>
      undertowMultipartMaxEntitySizeCustomizer(ServerProperties serverProperties) {

    long maxSize = serverProperties.getUndertow().getMaxHttpPostSize().toBytes();

    return factory ->
        factory.addBuilderCustomizers(
            builder -> {
              LOG.info("Applying MULTIPART_MAX_ENTITY_SIZE={} to Undertow builder", maxSize);
              builder.setServerOption(UndertowOptions.MULTIPART_MAX_ENTITY_SIZE, maxSize);
            });
  }

Which seems like a bug.

Regards,

Richard Opalka

unread,
Jan 28, 2026, 6:30:39 AMJan 28
to Allan BURDAJEWICZ, Undertow Dev
Hello Allan,

   This is a known issue https://issues.redhat.com/browse/UNDERTOW-2677 that will be handled in the next micro release.

Rio

--
You received this message because you are subscribed to the Google Groups "Undertow Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to undertow-dev...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/undertow-dev/65ac932a-eef0-4eff-8ce5-95055ab3b95dn%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Allan BURDAJEWICZ

unread,
Jan 29, 2026, 6:17:38 PMJan 29
to Undertow Dev
Got it. Thanks!
Reply all
Reply to author
Forward
0 new messages