fix: allow multipart overhead for 500mb uploads

This commit is contained in:
hy001 2026-05-15 11:57:05 +08:00
parent 403cff15c0
commit f60a850ec8
4 changed files with 10 additions and 10 deletions

View File

@ -9,13 +9,13 @@ import org.springframework.context.annotation.Configuration;
@Configuration @Configuration
public class UndertowUploadLimitConfiguration { public class UndertowUploadLimitConfiguration {
private static final long MAX_UPLOAD_SIZE_BYTES = 500L * 1024 * 1024; private static final long MAX_UPLOAD_REQUEST_SIZE_BYTES = 520L * 1024 * 1024;
@Bean @Bean
public WebServerFactoryCustomizer<ConfigurableUndertowWebServerFactory> undertowUploadLimitCustomizer() { public WebServerFactoryCustomizer<ConfigurableUndertowWebServerFactory> undertowUploadLimitCustomizer() {
return factory -> factory.addBuilderCustomizers(builder -> { return factory -> factory.addBuilderCustomizers(builder -> {
builder.setServerOption(UndertowOptions.MAX_ENTITY_SIZE, MAX_UPLOAD_SIZE_BYTES); builder.setServerOption(UndertowOptions.MAX_ENTITY_SIZE, MAX_UPLOAD_REQUEST_SIZE_BYTES);
builder.setServerOption(UndertowOptions.MULTIPART_MAX_ENTITY_SIZE, MAX_UPLOAD_SIZE_BYTES); builder.setServerOption(UndertowOptions.MULTIPART_MAX_ENTITY_SIZE, MAX_UPLOAD_REQUEST_SIZE_BYTES);
}); });
} }

View File

@ -4,7 +4,7 @@ server:
servlet: servlet:
context-path: /console context-path: /console
undertow: undertow:
max-http-post-size: 500MB max-http-post-size: 520MB
no-request-timeout: 60000 no-request-timeout: 60000
spring: spring:
@ -21,7 +21,7 @@ spring:
servlet: servlet:
multipart: multipart:
max-file-size: 500MB max-file-size: 500MB
max-request-size: 500MB max-request-size: 520MB
enabled: true enabled: true
--- ---
spring: spring:

View File

@ -9,13 +9,13 @@ import org.springframework.context.annotation.Configuration;
@Configuration @Configuration
public class UndertowUploadLimitConfiguration { public class UndertowUploadLimitConfiguration {
private static final long MAX_UPLOAD_SIZE_BYTES = 500L * 1024 * 1024; private static final long MAX_UPLOAD_REQUEST_SIZE_BYTES = 520L * 1024 * 1024;
@Bean @Bean
public WebServerFactoryCustomizer<ConfigurableUndertowWebServerFactory> undertowUploadLimitCustomizer() { public WebServerFactoryCustomizer<ConfigurableUndertowWebServerFactory> undertowUploadLimitCustomizer() {
return factory -> factory.addBuilderCustomizers(builder -> { return factory -> factory.addBuilderCustomizers(builder -> {
builder.setServerOption(UndertowOptions.MAX_ENTITY_SIZE, MAX_UPLOAD_SIZE_BYTES); builder.setServerOption(UndertowOptions.MAX_ENTITY_SIZE, MAX_UPLOAD_REQUEST_SIZE_BYTES);
builder.setServerOption(UndertowOptions.MULTIPART_MAX_ENTITY_SIZE, MAX_UPLOAD_SIZE_BYTES); builder.setServerOption(UndertowOptions.MULTIPART_MAX_ENTITY_SIZE, MAX_UPLOAD_REQUEST_SIZE_BYTES);
}); });
} }

View File

@ -2,7 +2,7 @@ server:
port: 3000 port: 3000
shutdown: graceful shutdown: graceful
undertow: undertow:
max-http-post-size: 500MB max-http-post-size: 520MB
no-request-timeout: 60000 no-request-timeout: 60000
spring: spring:
@ -13,7 +13,7 @@ spring:
servlet: servlet:
multipart: multipart:
max-file-size: 500MB max-file-size: 500MB
max-request-size: 500MB max-request-size: 520MB
enabled: true enabled: true
profiles: profiles:
active: @profiles.active@ active: @profiles.active@