2

I have uploaded springboot Rest APi over elastic beanstack, as a WAR file. Rest API is actually uploading file here is my code

@PostMapping(value = "/post")
@PreAuthorize("hasAuthority('WRITE')")
public ResponseEntity<?> createPost(@RequestParam String postData,
                                    @RequestPart(value = "attachments", required = false)
                                            MultipartFile attachments) {
    PostEntity postEntity = getPostEntity(postData);
    return new ResponseEntity<>(postService.createPost(postEntity, attachments), HttpStatus.CREATED);
}

its working fine in local enviroment, I am able to upload file up 50 MB (so for I tried). But after deploying on AWS cloud, its giving me Request Entity Too Large (413) error.

What Tried so far:

I created src/main/resources/.ebextensions/nginx/conf.d/proxy.conf file and inside that I have put

client_max_body_size 100M;

But it didn't work somehow.

I have also tried this approach:

If anyone has any suggestion please share suggestion here.

Sandeep Tiwari
  • 2,042
  • 3
  • 24
  • 47

1 Answers1

1

I followed below blog :

https://medium.com/@robin.srimal/how-to-fix-a-413-request-entity-too-large-error-on-aws-elastic-beanstalk-ac2bb15f244d

sudo vim ngnix.conf

Sandeep Tiwari
  • 2,042
  • 3
  • 24
  • 47