개발/1일1문제해결

[Apache] 413 Request Entity Too Large 오류 해결

Gamii 2024. 3. 7. 22:59
728x90

[문제]

 

클라이언트에서 1GB가 넘는 영상을 업로드를 하려고 했을 때 "Request Entity Too Large" 오류가 나타났다.  클라이언트가 서버로 전송한 요청 본문의 크기가 서버에서 허용하는 최대 크기를 초과했을 때 발생하는 현상이었다. 클라이언트에서 Apache로 넘어가는 부분에서 발견되서 Apache 설정을 먼저 확인했다. 

 

 

 

 

 

 

[해결]

Apache의 httpd.conf를 아래 코드를 최하단에 추가 했더니 해결됬다.

LimitRequestBody 0 
LimitXMLRequestBody 0

 

 

1. LimitRequestBody

클라이언트 HTTP에서 텍스트 기반 요청 본문의 전체 크기를 제한하는데 사용된다.

 

즉, 클라이언트가 서버로 보낼 수 있는 본문 최대 크기를 제한할 수 있다. 0(무제한) ~ 214748647(2GB)까지 설정 가능하고 단위는 바이트이다.(default는 0이다.)

 

0으로 설정할 경우 무제한으로 설정되므로 보안을 위해서 적절한 파일 사이즈 용량을 설정하는 것이 좋다. 

 

 

 

 

2. LimitXMLRequestBody

LimitXMLRequestBody는 XML형식의 요청 본문의 크기를 제한하는데 사용된다.  단위는 byte이고 defaut는 1000000byte이다. 

 

 

 

 

 

 

참고)

https://httpd.apache.org/docs/2.0/mod/core.html#limitrequestbody

 

core - Apache HTTP Server

This directive controls whether requests that contain trailing pathname information that follows an actual filename (or non-existent file in an existing directory) will be accepted or rejected. The trailing pathname information can be made available to scr

httpd.apache.org