errors是什么意思(error错误)

百科 0 576
1错误出现.

2.INFO org.apache.tomcat.util.http.parser.Cookie:180 - A cookie header was received [1616654554; Hm_lvt_1cd9bcbaae133f03a6eb19da6579aaba=1616556775,1616642545,1616748787] that contained an invalid cookie. That cookie will be ignored.Note: further occurrences of this error will be logged at DEBUG level.

Error parsing HTTP request header Note: further occurrences of

HTTP header parsing errors

errors是什么意思(error错误)

错误提示:

Error parsing HTTP request header Note: further occurrences of

HTTP header parsing errors

Invalid character found in method name. HTTP method names must be 、

tokens

3.

问题分析: 这个问题,很多说是要tomcat的server.xml文件中加入 maxHttpHeaderSize=“8192” 。

protocol="HTTP/1.1"

connectionTimeout="20000"

redirectPort="8443"

maxHttpHeaderSize="8192"

URIEncoding="UTF-8"/>

那么从 maxHttpHeaderSize 属性名称,我们就可以发现,是因为 HTTP 请求 的头部过长导致的。

那么为什么会产生这个情况呢? 通常的原因其实是这样的

后端给移动端提供的接口,要求使用Post方式提交,然后移动端调用的时候。

却是直接把参数和值都添加到了URL后面,所以这就导致URL过长,就出现了这样的问题。

知道了问题的本质,当然你应该已经想到了解决的方法,以及上面给出的解决方法的原因。

4.解决方法:

1、修改 maxHttpHeaderSize 的大小

但是这个大小多大合适呢?

没有具体的大小,默认是4K,也就是4096。

多数文章给出的是8192,提高一倍按理是可以解决问题,也可能是互相借鉴的

结果。

但也有文章提到的极端值是 32K,具体的数字自己计算一下吧。

2、调用端改为真正的Post提交

另外一种分析:

org.apache.tomcat.util.http.parser.Cookie.logInvalidHeader A cookie header was received

因为新版tomcat的cookie处理warn比老版严格造成,由tomcat6升级到tomcat8就会有这个问题。

[http-nio-8080-exec-5] org.apache.tomcat.util.http.parser.Cookie.logInvalidHeader A cookie header was received [XX] that contained an invalid cookie. That cookie will be ignored.Note: further occurrences of this error will be logged at DEBUG level.

解决方法:添加LegacyCookieProcessor文件来替代默认的cookie设置(cookie解析器)

apache-tomcat-8.5.12/conf/context.xml

WEB-INF/web.xml

${catalina.base}/conf/web.xml

相关推荐: