1. Springboot 2.1.0 reports an error when the upload file is too large
Maximum upload size exceeded; nested exception is java.lang.IllegalStateException: org.apache.tomcat.util.http. fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (216185201) exceeds the configured maximum (104857600)
2. Solution:
1 .Check whether Nginx can limit the request data size
server {
listen 80;
#server_name localhost;
client_max_body_size 500M;
#charset koi8-r;
#access_log logs/host.access.log main;
location /test/ {
proxy_pass http://127.0.0.1:8080/test/;
}
}
Among them: client_max_body_size 500M; must be opened, release restrictions
3. Check whether tomcat can limit the request data size
In D:\Program Files\Apache Software Foundation\Tomcat 8.5\conf\server.xml
## connectionTimeout="20000"
connectionTimeout="20000"
maxPostSize=" -1"
## redirectPort="8443" />maxPostSize sets the request size, -1 means no limit
4.springboot Set request size limitConfigure in application.properties:
spring.servlet.multipart.max-file-size=500MBspring.servlet.multipart.max-request-size=500MB######
The above is the detailed content of How to solve the error when uploading file in springboot is too large. For more information, please follow other related articles on the PHP Chinese website!