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

在启动项目时遇到logInvalidHeader 的警告,当然不影响系统的运行,

先说问题来源: 是因为新版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解析器)

cat /usr/local/apache-tomcat-8.5.12/conf/context.xml

<?xml version="1.0" encoding="UTF-8"?>
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>

<!--
<CookieProcessor className="org.apache.tomcat.util.http.Rfc6265CookieProcessor" />
-->

<CookieProcessor className="org.apache.tomcat.util.http.LegacyCookieProcessor" />
Rfc6265CookieProcessor这个配置不管用,问题出处:

https://stackoverflow.com/questions/36665320/a-cookie-header-was-received-that-contained-an-invalid-cookie

https://www.cnblogs.com/passedbylove/p/7587142.html#4166573

配置方案LegacyCookieProcessor说明:

https://tomcat.apache.org/tomcat-8.5-doc/config/cookie-processor.html#Legacy_Cookie_Processor_-_org.apache.tomcat.util.http.LegacyCookieProcessor
————————————————
版权声明:本文为CSDN博主「wenyanxing」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/wenyanxing/article/details/89640054

发布了14 篇原创文章 · 获赞 0 · 访问量 920

猜你喜欢

转载自blog.csdn.net/qq_35201262/article/details/105661726
今日推荐