1. 설정

2-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 that FailedRequestFilter filter can be used to reject requests that hit the limit.

2-2. 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 zero. If not specified, this attribute is set to 2097152 (2 megabytes). Note that the FailedRequestFilter can be used to reject requests that exceed this limit.

2. 주의사항

server.xml 설정 파일에 아래와 같은 파라미터가 설정되어 있고 특히 0으로 되어 있지 않은지 본다.
 
0 설정 관련하여 정확히는 Tomcat 7.0.63 기준으로 다르다.
 
  • Tomcat 7.0.63 미만 : maxPostSize를 0으로 설정하면 무제한
  • Tomcat 7.0.63 이후 & Tomcat 8.x 이후 : maxPostSize를 -1로 설정해야 무제한

3. 예제

  • 만약 maxPostSize="8"로 잡았다고 하자.
  • key=abcde 라는 POST 데이터를 넘긴다고 하면 넘어가지 않는다.
  • key=abcd 는 넘어간다. 8바이트이기 때문이다.
<Connector port="8180" protocol="org.apache.coyote.http11.Http11NioProtocol" maxPostSize="8" maxThreads="1024" URIEncoding="UTF-8" acceptCount="10" enableLookups="false" compression="false" connectionTimeout="20000" redirectPort="8543" />