INFO [http-nio-8081-exec-53] 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.
java.lang.IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokens
at org.apache.coyote.http11.AbstractNioInputBuffer.parseRequestLine(AbstractNioInputBuffer.java:232)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1013)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:670)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
在阿里云服务器上部署了一个tomcat8的服务,总是每隔一段时间报这个错误,虽然不太影响运行,但看起来还是不太好看,经历了一段时间的摸索找到了解决方法:
-
修改tomcat->conf->server.xml: 注释掉以下内容:
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
-
修改tomcat->conf->catalina.properties 在文件最后新增以下内容:
tomcat.util.http.parser.HttpParser.requestTargetAllow=|{}
org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true
|