Tomcat 7.x : POST 전송 - maxPostSize 속성값 minor 버전에 따른 설정 차이

2019. 5. 23. 16:46모두모두 개발자다요/etc.

이미지 파일 업로드가 아닌, 이미지 파일의 data string 변환 값을 (data:image/) tomcat 환경에서 전송하는 개발 중에, 문자열 값이 대~빵 늘어날 것을 우려하여 POST 전송 파라미터 사이즈에 max값을 무한으로 설정할 방법을 찾아보았다.

tomcat server.xml

<Connector URIEncoding="UTF-8" connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443" maxPostSize="0"/>

요 connector 설정 속성중에 마지막에 "maxPostSize" 라는 속성명을 추가하여 "0" 값을 주면 post 전송 데이터 무한 설정이 가능하다고 하길래 .. 적용 후에 테스트를 해보았으나..

 

전송값 size 와 관계 없이.. 그냥 모든 POST 요청의 파라미터 값이 서버에서 null 으로 받아지는 사태가 발생!!

브라우저 콘솔 request 정보에는 분명히 모든 전송 파라미터 값이 로깅되고

서버 사이드는 당췌 아무런 값도 안 찍히고 (흔한 java spring/mvc app) 

 

... (왜 나한테만 이래??;;) 

다른 팀원 개발 환경 설정과 비교, 애플리케이션 소스 sync 비교, 나 없을때 다른 소스에 무슨 짓 했는지 탐정 추리.. 오만가지 삽질 끝에 일단 내가 저지른 행위를 모두 revert 하고 초심으로 돌아가 구글 신께 다시 (기도를 들였다.) 문의를 했다.

참고한 사이트 : https://sarc.io/index.php/tomcat/948-tomcat-post-parameter

 

Tomcat에서 POST 처리가 잘 안될 때 확인 parameter

Technical Note 정보 나크나로 님이 작성하신 글입니다. 게시됨: 12 October 2017 작성됨: 12 October 2017 최종 변경: 20 February 2018 조회수: 3753 1. 설정 2-1. maxParameterCount The maximum number of parameter and value pairs (GET plus POST) which will be automatically parsed by the containe

sarc.io

그랬다..

내가 사용하는 tomcat 버전 7!! (7.0.75)

7이면 다 그냥 같은 7.x 인줄 알았더니.. 아니 왜 하필 minor 버전에 따라 설정 방법이 달랐다니;;

7.0.63 이전은 maxPostSize="0"

7.0.63 이후는 maxPostSize="-1"

https://tomcat.apache.org/tomcat-7.0-doc/config/http.html

 

Apache Tomcat 7 Configuration Reference (7.0.94) - The HTTP Connector

Common Attributes All implementations of Connector support the following attributes: AttributeDescriptionallowTrace A boolean value which can be used to enable or disable the TRACE HTTP method. If not specified, this attribute is set to false. asyncTimeout

tomcat.apache.org

아파치 톰캣 7 설정 문서에 "The limit can be disabled by setting this attribute to a value less than zero라고 설명하고 있는 걸 먼저 알아봤다면 아마 "-1" 으로 바로 적용했을텐데.. (문서에도 딱히 마이너 몇 이상/이하 다르다는 설명은 따로 발견하지는 못했다;;)

<Connector URIEncoding="UTF-8" connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443" maxPostSize="-1"/>

 

 

'모두모두 개발자다요 > etc.' 카테고리의 다른 글

Postman 구글 앱  (0) 2017.07.25
dummy 이미지 생성  (0) 2017.04.26
WAS 포트 겹침;;;  (0) 2014.06.19
Free WEB UI Element Kits 라는데...  (0) 2011.02.08