Home > Back-end >  Getting 503 exception when sending large file as body in post request
Getting 503 exception when sending large file as body in post request

Time:01-11

Below is my rest end point and code. I am trying to upload a large file by using Multipart, but when I am attaching a large file (>100MB)in postman I am getting 503 error and request is not coming to my server.

@PostMapping("load/largefile")
    public ResponseObj loadHaevyFileToS3(@RequestPart(value = "file") MultipartFile jsonDataFile) {
        return new ResponseObj(true,loadService.load(jsonDataFile));
    }

But when I am attching file of smaller size it is working fine

I have added the below properties in my application.properties.

spring.servlet.multipart.max-request-size=500MB
spring.servlet.multipart.max-file-size=500MB
server.tomcat.max-http-form-post-size=500MB

I don't know what I am missing here, please help me out. Thanks in advance. Postman Screen shot

CodePudding user response:

which version of your spring-boot, your config looks like version 2

CodePudding user response:

To upload a large file or any file you have to explicitly enable multipart as true be default it is false So to that use the following command in application.properties

 spring.servlet.multipart.enabled=true
  • Related