1、springboot 2.1.0 上传文件太大报错
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、处理方案:
1.查看Nginx 能否有限制请求数据大小
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/;
}
}
其中: client_max_body_size 500M;必需打开,放开限制
3.查看tomcat能否有限制请求数据大小
在D:\Program Files\Apache Software Foundation\Tomcat 8.5\conf\server.xml
connectionTimeout="20000"
maxPostSize="-1"
redirectPort="8443" />
maxPostSize 设置请求大小,-1代表不限制
4.springboot 设置请求大小限制
在application.properties配置:
spring.servlet.multipart.max-file-size=500MB
spring.servlet.multipart.max-request-size=500MB
以上是springboot上传文件太大报错怎么解决的详细内容。更多信息请关注PHP中文网其他相关文章!