Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

721
Views
Configuring nginx client_max_body_size on Elastic Beanstalk Node

I have a Node 10 app running on Elastic Beanstalk, and it throws 413 errors when the request payload is larger than ~1MB.

<html>

<head>
    <title>413 Request Entity Too Large</title>
</head>

<body>
    <center>
        <h1>413 Request Entity Too Large</h1>
    </center>
    <hr>
    <center>nginx/1.16.1</center>
</body>

</html>

The request is not hitting my app at all; it's being rejected by nginx.

I have tried configuring AWS to increase the size of the allowed request body based on this answer, to no avail.

I've tried adding a file at .ebextensions/01_files.config with the contents:

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

That didn't work, so I tried adding the file directly to .ebextensions/nginx/conf.d/proxy.conf with only:

client_max_body_size 20M;

And this also didn't work. Then I SSH'ed into the instance and added the file directly. Upon re-deploy, the entire conf.d directory was deleted and re-written, without this file.

How can I get AWS Elastic Beanstalk with Node.js 10 running on 64bit Amazon Linux 2/5.1.0 to accept nginx configuration?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

The nginx setting you are trying to use (/etc/nginx/conf.d/proxy.conf) is for Amazon Linux 1.

Since you are using Amazon Linux 2 you should be using different files for setting nginx. For AL2, the nginx settings should be in .platform/nginx/conf.d/, not in .ebextentions as shown in the docs.

Therefore, you could have the following .platform/nginx/conf.d/myconfig.conf with content:

client_max_body_size 20M;

The above is an example only of the config file. I can't verify if the setting will actually work, but you are definitely using wrong folders to set nginx options.

My recommendation would be to try to make it work manually through ssh as you are attempting now. You may find that you need to overwrite entire nginx setting if nothing works by providing your own .platform/nginx/nginx.conf file.

over 4 years ago · Santiago Trujillo Report

0

adding the client_max_body_size 20M; in the folder .platform/nginx/conf.d/proxy.conf fixed it for me. Please make sure to check whether you are using Amazon Linux 2

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!