springboot 上传解决 413 Request Entity Too Large

springboot上传文件出现问题 413 Request Entity Too Large.

debug查看上传文件的body大小,Content-Length后面就是。

springboot 上传解决 413 Request Entity Too Large_第1张图片

修改后端配置参数,举例是允许最大500M上传。

spring:
  servlet:
    multipart:
      max-file-size: 5120MB
      max-request-size: 5120MB

springboot 上传解决 413 Request Entity Too Large_第2张图片

前端如果是nginx做的转发,也要处理。nginx默认上传是1M,修改配置文件。

在http{}中加入 client_max_body_size 500m;

然后重启nginx.

你可能感兴趣的:(java,springboot,上传文件)