tomcat nginx默许的post大小限制 - ashorefish/-software-test GitHub Wiki

tomcat nginx默认的post大小限制

执行大文件上传,或者,大数据量提交时,当提交的数据大小超过一定限制时,发现后台从request取值的代码request.getParameter("message")返回值为null,原因是因为服务器对于提交的post请求的大小有一定的限制

tomcat:默认大小2097152,当maxPostSize=负数时,不限制;maxPostSize=20971520时,为20M nginx:默认的最大请求body大小为8m,修改设置client_max_body_size=100m; resin:没有发现默认限制请求大小的地方!

Tomcat配置文件server.xml,修改 maxPostSize,然后保存

tomcat.maxPostSize在这种content-type下才会起作用:application/x-www-form-urlencoded

tomcat7.0.63之前: 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). 设置为0和负数均可以代表不限制

tomcat7.0.63(包含)之后: 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). 不可以设置为0,只能是负数代表不限制

Nginx的"413 request entiry too large" tomcat返回400 tomcat请求端口都加上maxPostSize="0"