'SpringBoot 2.0 - FileSizeLimitExceededException even with correct parameters set
I've set those parameters in my application.yml:
spring:
servlet:
multipart:
max-file-size: -1
max-request-size: -1
and when I run it from IDE it works fine. The problem starts when I try to run it along with spring cloud, netflix eureka, and zuul proxy. It behaves like there is no such paramteters. It always throws:
"Maximum upload size exceeded; nested exception is java.lang.IllegalStateException: org.apache.tomcat.util.http.fileupload.FileUploadBase$FileSizeLimitExceededException: The field file exceeds its maximum permitted size of 1048576 bytes.",
Shall I set it somewhere else?
EDIT: My bootstrap.yml
spring:
profiles: docker
application:
name: test-service
sleuth:
sampler:
probability: 1
zipkin:
base-url: http://zipkin:9411/
cloud:
config:
discovery:
enabled: true
service-id: config-server
fail-fast: true
retry:
initial-interval: 2000
max-interval: 10000
multiplier: 2
max-attempts: 10
eureka:
instance:
hostname: test-service
prefer-ip-address: true
client:
registerWithEureka: true
fetchRegistry: true
serviceUrl:
defaultZone: http://eureka-server:8761/eureka/
management:
endpoints:
web:
exposure:
include: "*"
endpoint:
health:
show-details: ALWAYS
logging:
file: ./logs/log.log
Solution 1:[1]
Faced the same issue and found the solution, post it here still anyone needs help after 3years.
If your traffic flow through the Netflix Zuul edge service, you should update the below properties in both Zuul and your file upload application service.
for spring boot 2.x and above its
spring.servlet.multipart.max-file-size=-1
spring.servlet.multipart.max-request-size=-1
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Denuwan.hh |
