[AWS] elastic beanstalk 413 Request Entity Too Large 문제 해결

2023. 12. 25. 01:29AWS

- 상황

1MB보다 큰 데이터를 담아 요청을 보낸다.

 

- 문제

413 Request Entity Too Large 오류가 발생한다.

 

- 원인

elastic beanstalk에서 사용하는 nginx 서버가 1MB이하만 요청을 받을 수 있기 때문이다.

 

- 해결

nginx의 최대 요청 용량을 변경한다.

1. 다음의 구조를 가지는 .platform을 만든다.

client_max_body_size.conf 안의 내용은 다음과 같다.

client_max_body_size 50M;

숫자는 원하는 사이즈로 변경하면 된다.

 

2. .platform 폴더를 jar파일과 같은 디렉토리에 넣고 다음의 명령을 통해 zip으로 압축한다.

zip -r deployment-package.zip my-application.jar .platform/

 

3. elastic beanstalk에 zip 파일을 배포한다.

 

Reference


https://repost.aws/knowledge-center/elastic-beanstalk-nginx-configuration

 

Modify client_max_body_size in Elastic Beanstalk

I want to upload large size files to my AWS Elastic Beanstalk environment without receiving the error message "413 Request Entity Too Large".

repost.aws