环境
Tomcat 8.x
报错
Invalid character found in the HTTP protocol [HTTP/1.1 Connection:]
分析
查看localhost_access_log.txt发现:
HEAD / 400
都是HEAD 请求,且返回都是400,毕竟HTTP协议的字符不正确。
调研
How to solve "Invalid character found in the HTTP protocol [HTTP/1.10x0aHost:]"?
这篇文章说了HTTP协议格式是这样的:
"GET " + path + " HTTP/1.1\r\n"
推测
推测有个崽写了这样的请求,缺少一个换行
"HEAD / HTTP/1.1 Connection"
破案
最终发现是 nginx配置了一个健康检查:
check_http_send "HEAD / HTTP/1.1 Connection: keep-alive ";
正确写法
check_http_send "HEAD / HTTP/1.1\r\nConnection: keep-alive ";
当然有没有这个URL PATH 就是另一个回事了,如果404 Not Found,也还是返回4xx的错误信息。
- character protocol 错误 Invalid foundcharacter protocol错误invalid indentation character cannot found illegalargumentexception character invalid method statement invalid bound found springboot character invalid request character timestamp错误 日期 39 unicodeencodeerror character错误 quot应用服务characters错误 character错误 数字buffer statement错误invalid方法