0

I've the below uploadfile method to upload multipart files and I see 413 Request Entity Too Large while uploading a large size file like 28MB. I've set maxPostSize to 50MB in tomcat 9 server configurations and also tried which is suggested in below link. I've added below spring.servlet properties in application.properties file.

spring.servlet.multipart.max-file-size=-1
spring.servlet.multipart.max-request-size=-1
spring.servlet.multipart.enabled=true
@PostMapping(********)
@ResponseBody
public response uploadfile(
    @RequestParam(value = "id", required = true) String id,
    @RequestPart(value = "file", required = false) MultipartFile multipartFile,
    @RequestPart(required = true) data data) throws ServicesException {
    return service.uploadfile(id, multipartFile, data);
}

I've tried suggestions in below link but still seeing the same error: Spring Boot Upload Multipart 413 Request Entity Too Large

flaxel
  • 4,173
  • 4
  • 17
  • 30

1 Answers1

2

Do you use ngrok or any proxy? By default in Spring, you should get:

"status": 500,
"error": "Internal Server Error",
"message": "Maximum upload size exceeded; nested exception is java.lang.IllegalStateException: org.apache.tomcat.util.http.fileupload.impl.FileSizeLimitExceededException: The field file exceeds its maximum permitted size of 1048576 bytes.",

So I think you should check some firewall configurations, because the issue may lie there.

Danon
  • 2,771
  • 27
  • 37