Tomcat Post로 넘어가는 파라미터 갯수와 size 설정 :: 개발/일상_Mr.lee

Tomcat Post로 넘어가는 파라미터 갯수와 size 설정

Posted by Mr.mandu.
2017. 9. 10. 09:00 개발/was

프로젝트를 진행하던 도중  다음과 같은 에러를 만났습니다. 

사실 아래의 메시지는 톰캣용이 아니고 제우스 에러 입니다.

하지만 현재 개발서버가 톰캣이기 때문에 톰캣용으로 해결책을 찾았습니다.


<input type="hidden" name="error" value='JBWEB002004: More than the maximum number of request parameters (GET plus POST) for a single request (512) were detected. Any parameters beyond this limit have been ignored. To change this limit, set the maxParameterCount attribute on the Connector.' />


바로 파라미터 개수가 설정 해놓은 개수보다 초과했기 때문입니다.

톰캣에서 설정해 놓을 속성은!  maxPostSize와 maxParameterCount입니다. 

 

Tomcat은 기본적으로 Post로 넘어갈 수 있는 Parameter 최대 Size가 2097152 (2 megabytes), 최대 Parameter갯수는 10000개입니다.(Tomcat 7.0기준)

 

get방식 말고 Post 방식에도 제한이 있다는 사실을 이번에 처음 알게되었습니다.


이제 maxPostSize 와 maxParameterCount의 속성값을 변겨해보도록 하겠습니다.

Tomcat의 server.xml에서 Connector Tag 부분을 찾습니다.

maxPostSize 설정은 원하는 Size를 지정하거나 maxPostSize="700000",

무제한으로 설정 :  maxPostSize="0" 또는 0보다 작은 값을 기입해주시면 됩니다.



 


maxPostSize  관련내용

(The maximum size in bytes of the POST which will be handled by the container FORM URL parameter parsing. The limit can be disabled by setting this attribute to a value less than or equal to 0. If not specified, this attribute is set to 2097152 (2 megabytes).)

 

maxParameterCount개수도 특정값으로 설정해주시고나

무제한으로 설정하려면 0 또는 음수로 기입해주시면 됩니다.

ex) maxParameterCount="20000", (maxParameterCount="-1"

 

maxParameterCount 관련내용

(The maximum number of parameter and value pairs (GET plus POST) which will be automatically parsed by the container. Parameter and value pairs beyond this limit will be ignored. A value of less than 0 means no limit. If not specified, a default of 10000 is used. Note thatFailedRequestFilter filter can be used to reject requests that hit the limit.)

 

예시

<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"  URIEncoding="euc-kr" maxPostSize="-1" maxParameterCount="-1" />