Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I increase the client_max_body_size in Elastic Beanstalk

I am using Golang with elastic Beanstalk and I find that I am able to upload files up to 1 MB and the ones bigger than that fail with the error client intended to send too large body: 1749956 bytes the bytes obviously depend on the file size . I have been reading this post Increasing client_max_body_size in Nginx conf on AWS Elastic Beanstalk and I changed my code created a file 01_nginx.config under the ebExtensions and put the following in it and I try to upload a video of 3 MB and it still gives that error, any suggestions ? I am new to this

files:
    "/etc/nginx/conf.d/proxy.conf" :
        mode: "000755"
        owner: root
        group: root
        content: |
           client_max_body_size 20M;
like image 718
user1591668 Avatar asked May 17 '18 00:05

user1591668


People also ask

How do you increase timeout in Elastic Beanstalk?

Sign in toAWS Console. Go to EC2 Services. On the left panel, click on the Load Balancing > Load Balancers. In the top panel, select the Load Balancer for which you want to change the idle timeout.

Does Elastic Beanstalk use load balancer?

Elastic Beanstalk fully manages this load balancer, taking care of security settings and of terminating the load balancer when you terminate your environment.

What type of load balancer does Elastic Beanstalk use?

When your environment uses a Classic Load Balancer, Elastic Beanstalk configures it by default to listen for HTTP traffic on port 80 and forward it to instances on the same port. To support secure connections, you can configure your load balancer with a listener on port 443 and a TLS certificate.


1 Answers

I have tried all .ebextensions method of adding implementation level configuration for rails and it didn't help me in the latest Amazon Linux AMI. For the latest Amazon Linux AMI You need to follow this structure to increase the upload size. You need to follow this structure to increase the upload size limit.

Add the below folder setup in the root level of your project folder.

Folder structure (.platform/nginx/conf.d/proxy.conf)

.platform/
         nginx/
              conf.d/
                    proxy.conf

Add this line to proxy.conf (Inside .platform/nginx/conf.d/ folder)

client_max_body_size 50M;

commit this file and deploy again using eb deploy.

like image 118
Muhammad Umair Raza Avatar answered Nov 14 '22 12:11

Muhammad Umair Raza