'POST안넘어갈때'에 해당되는 글 1건

  1. 2020.11.25 Tomcat POST 값이 넘어가지 않을때
Web&Spring2020. 11. 25. 12:30

 

 

 

설정값에 따라서 POST로 보내는 데이터가 전달이 되지 않을 때가 있다.

분명히 submit을 했는데, request에 값이 안담겨있다..

이럴때는 Tomcat 설정을 확인해줘야 한다.

server.xml 설정 파일에 아래와 같은 파라미터가 있고, 해당 파라미터가 어떻게 세팅되어있는지 확인하고, 

세팅이 안되어있다면 추가해준다.



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. 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.






0 설정 관련하여서는 정확히 Tomcat 7.0.73 기준으로 다르다고 한다.
- Tomcat 7.0.63 미만 : maxPostSize를 0으로 설정하면 무제한
- Tomcat 7.0.63 이후 & Tomcat 8.x 이후 : maxPostSize를 -1로 설정해야 무제한

간단히 예를들어 maxPostSize를 10으로 잡았다고하면,
key=1234567은 넘어가지 않고(11바이트) key=123456은 넘어간다.
-1은 제한없이 key=123456789.... 해도 넘어가는 거고.

예제)

 

<Connector port="8080" protocol="org.apache.coyote.http11.Http11NioProtocol" 
maxPostSize="-1" maxParameterCount="-1" maxThreads="1024" 
URIEncoding="UTF-8" acceptCount="10" enableLookups="false" compression="false" 
connectionTimeout="20000" redirectPort="8443" />

 

 

결론은, maxPostSize와 maxParameterCount를 확인하자!

 

 

Posted by 사슴영혼'-'