Spring boot application on Elastic beanstalk Upload Large files

0

Hallo guys, I'm writing to you in hope to get a help on a problem I'm facing, so basically I created a spring boot rest API for my app and I used AWS Elasticbeanstalk to deploy, now when I try to upload a file to my S3 bucket using the rest API, I'm facing an error saying that the body of my request is too large, even for some image files not larger than 1MB. So please how can I solve that issues.

Here's the error part of the logs of the app: 2023/03/21 05:12:26 [error] 2736#2736: *56 client intended to send too large body: 3527163 bytes, client: ..., server: , request: "POST /mobile/create_post HTTP/1.1", host: "..."

1 Answer
0

Hello,

Thank you for your query.

I understand that you have deployed a spring boot REST API on Elastic Beanstalk however when using the API to upload a file in S3 bucket, you are getting the error saying that the request body is too large.

Proceeding further, if you are using Nginx proxy for the application, so be default the max size for client request is set to 1MB and you will get an error when a larger file is uploaded.

From the error itself we can see that a file of size 3527163 bytes (~ +3Mb) is sent and hence the error. Therefore, can you please confirm which proxy you are using, and refer this link for increasing the request body size. https://repost.aws/knowledge-center/elastic-beanstalk-nginx-configuration

If you are using Apache, you can follow the same approach to increase the limits as well. [] Extending Elastic Beanstalk Linux platforms - https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/platforms-linux-extend.html

Hoping that the above helps. Thank you.

AWS
SUPPORT ENGINEER
answered a year ago
  • I've tried your solution like this:

    1- created myapp/.platform/nginx/conf.d/client_max_body_size.conf. client_max_body_size 50M; in my application source code using IntelliJ IDE 2- then I built jar file in target directory using "mvn clean install" 3- then uploaded the jar file to elastic beanstalk.

    But still the problem isn't solved

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions