首页 > 代码库 > [Java Web]Error parsing HTTP request header Note: further occurrences of HTTP header parsing errors

[Java Web]Error parsing HTTP request header Note: further occurrences of HTTP header parsing errors

手机客户端向服务器提交Http请求时,Tomcat抛出错误:

十二月 31, 2014 2:32:45 下午 org.apache.coyote.http11.AbstractHttp11Processor process
信息: Error parsing HTTP request header
 Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.

经过调试后发现是Tomcat的header缓冲区大小不够,只需要在server.xml中增加maxHttpHeaderSize字段即可:

<Connector URIEncoding="UTF-8" port="8080" protocol="org.apache.coyote.http11.Http11NioProtocol"
	useBodyEncodingForURI="false"
	enableLookups="false"
               connectionTimeout="20000"
               redirectPort="8443" maxHttpHeaderSize="你想要的大小"/>

不过使用Web提交就不会出现这种问题,即使手机端再三强调使用的是Post方式,仍怀疑是因为使用的Get导致Header数据过长.

[Java Web]Error parsing HTTP request header Note: further occurrences of HTTP header parsing errors