springboot应用服务报错Error parsing HTTP request header

springboot后端服务报错Error parsing HTTP request header

问题:

我司有一个springboot系统,只提供dubbo接口,不对外提供htttp服务。

但是测试环境偶尔出现异常如下:

2020-03-07 00:49:41.025 INFO  [http-nio-8081-exec-8] [] [] org.apache.coyote.http11.Http11Processor#log(181) -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 the HTTP protocol
        at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:528) ~[tomcat-embed-core-8.5.11.jar!/:8.5.11]
        at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:667) [tomcat-embed-core-8.5.11.jar!/:8.5.11]
        at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.11.jar!/:8.5.11]
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:798) [tomcat-embed-core-8.5.11.jar!/:8.5.11]
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1434) [tomcat-embed-core-8.5.11.jar!/:8.5.11]
        at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.11.jar!/:8.5.11]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_121]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_121]
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.11.jar!/:8.5.11]
        at java.lang.Thread.run(Thread.java:745) [?:1.8.0_121]

分析:有人进行了http请求,系统无法处理报错。

解决方案:禁用springboot的web服务。

	public static void main(String[] args) {
 		// 程序启动入口
		// 启动嵌入式的 Tomcat 并初始化 Spring 环境及其各 Spring 组件
		SpringApplication springApplication = new SpringApplication(Application.class);
		//如不打算向外提供http服务,建议此处不加载web环境
		springApplication.setWebEnvironment(false);
		springApplication.run(args);
		logger.info("Start success......");
    }

 

 

你可能感兴趣的:(spring,boot,springboot,parsing,HTTP,禁用web服务)