tomcat报错Error parsing HTTP request header处理
项目部署到linux服务器后,启动项目报以下错误
May 18, 2017 10:01:52 AM org.apache.coyote.http11.AbstractHttp11Processor process
INFO: Error parsing HTTP request header
Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.
java.lang.IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokens
at org.apache.coyote.http11.InternalInputBuffer.parseRequestLine(InternalInputBuffer.java:135)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:996)
产生这个错误的主要原因是 GET 方法传递的数据太多导致。
其实从代码层面上使用POST就可以解决,但是,为了不大面积的修改代码,从Tomcat配置上下手也是可以的。
修改路径如下:
tomcat-7.X\conf\server.xml
网上查了下,说是因为httpHeaderSize大小不够导致的,要修改tomcat的配置,新加一个字段maxHttpHeaderSize。配置后为:
<!--<Connector port="1080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="1443" />--> <Connector URIEncoding="UTF-8" acceptCount="100" compressableMimeType="text/html,text/xml,text/javascript,text/css,text/plain" compression="on" compressionMinSize="10240" connectionTimeout="20000" disableUploadTimeout="true" enableLookups="false" maxHttpHeaderSize="81920" maxSpareThreads="75" maxThreads="150" minSpareThreads="25" noCompressionUserAgents="gozilla, traviata" port="1080" protocol="HTTP/1.1" redirectPort="1443" />
测试后发现问题解决。
原文:https://blog.csdn.net/qq_35592011/article/details/72461625
https://blog.csdn.net/u013630349/article/details/72465731
https://blog.csdn.net/sinat_19425927/article/details/42294901