Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

413 Request Entity Too Large in Nginx and Amazon ElasticBeanstalk

There are a lot of answers to this problem (question 1 question 2) but this solution that should work, doesn't work for me:

files:
  "/etc/nginx/conf.d/proxy.conf" :
    mode: "000755"
    owner: root
    group: root
    content: |
        client_max_body_size 50M;

I have checked the status and contents of this created file via ssh and its correct. I also have tried other values and restarted the server multiple times.

client_max_body_size 0;

or

http {
   client_max_body_size 50M;
}

This values do not work either.

it just wont work, even with "just" a 6mb image. it work with smaller images around size of 0.5mb. It's a RoR app with "64bit Amazon Linux 2018.03 v2.8.0 running Ruby 2.5 (Puma)". The instance size is t2.micro.

like image 611
antpaw Avatar asked May 25 '18 15:05

antpaw


People also ask

What does 413 Request Entity Too Large mean?

What does “413 Request Entity Too Large” mean? A 413 HTTP error code occurs when the size of a client's request exceeds the server's file size limit. This typically happens when a client attempts to upload a large file to a web server, and the server responds with a 413 error to alert the client.


1 Answers

Try this. It worked for me:

content: |
    server {
        ***your server configuration***

        location / {
             client_max_body_size 100M;
        }
    }
like image 114
Nipun Chawla Avatar answered Dec 01 '22 00:12

Nipun Chawla