Servlet Multipart Configs related to file size aren't working
Hi Team,
For specifying the maximum size of a file that is acceptable to be uploaded to the server, we specify these options in the application properties
spring.servlet.multipart.maxFileSize=15MB
spring.servlet.multipart.maxRequestSize=15MB
These are working for a regular spring boot service running on it's default web server i.e Tomcat, but the same options does not seem to work when included in spring cloud gateway running on it's default web server i.e Netty
A spring boot service throws MaxFileLimitExceeded option when I try to upload a file(mp4 video) > 15MB in size
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.web.multipart.MaxUploadSizeExceededException: Maximum upload size exceeded;
Whereas spring cloud gateway does not block the request and allow to proceed through
Spring Boot version: 2.3.5.RELEASE & Java version: 1.8 Spring Cloud Train version: 2021.0.1 & Java version: 11
There is no size limit for uploading files on spring-cloud-gateway, check the specific application service configuration
What if I want to impose the size limit of files as I'd do on Zuul gateway with the below config
spring.servlet.multipart.maxFileSize=15MB spring.servlet.multipart.maxRequestSize=15MB
How do I achieve the same via Spring cloud gateway? If that's not possible, are there any alternatives?
spring.servlet.multipart.maxFileSize=15MB spring.servlet.multipart.maxRequestSize=15MB These don't work in spring-cloud-gateway, custom filter restricts files
Got it. Thanks
Gateway is not a servlet application, hence none of those will work. see https://stackoverflow.com/questions/57424649/spring-webflux-set-max-files-size-for-uploading-files