tomcat8 运行期错误HTTP header parsing errors
程序员文章站
2022-06-24 18:14:17
...
添加头部信息后,开发阶段没异常,部署到tomcat中调用时出现错误:
07-Dec-2016 16:03:57.210 信息 [http-nio-8080-exec-5] org.apache.coyote.http11.Http11Processor.service 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.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:462) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:667) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1410) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) 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)
需要在tomcat的server.xml中配置:
maxHttpHeaderSize="8192"
上面这行配置在这里:
<Connector port="8080" protocol="HTTP/1.1" maxHttpHeaderSize="8192" connectionTimeout="20000" maxThreads="150" maxSpareThreads="75" redirectPort="8443" />
上一篇: 通过header函数生成XML
下一篇: java request 防止盗链