Explore Courses Blog Tutorials Interview Questions
0 votes
in AWS by (19.1k points)

I'm running into "413 Request Entity Too Large" errors when posting files larger than 10MB to our API running on AWS Elastic Beanstalk.

I've done quite a bit of research and believe that I need to up the client_max_body_size for Nginx, however, I cannot seem to find any documentation on how to do this using Elastic Beanstalk. My guess is that it needs to be modified using an ebextension file.

Does anyone have thoughts on how I can up the limit? 10MB is pretty weak, there has to be a way to up this manually.

1 Answer

0 votes
by (44.3k points)
edited by

To maximise the upload size specifically, create a file at .ebextensions/nginx/conf.d/proxy.conf set the max body size to whichever you prefer

client_max_body_size 50M;

Create a change in your config file inside of .ebextensions to supplenment the nginx file. With this change, you can have a bigger post body size.

Inside the .ebextensions directory, create a 1file.config with the following contents:


    "/etc/nginx/conf.d/proxy.conf" :

        mode: "000755"

        owner: root

        group: root

        content: |

           client_max_body_size 20M;

This will generate the proxy.conf file inside the given directory which contains the single line client_max_body_size 20M.

Check out this link to learn more about Nginx configuration:

Browse Categories