解决方案:java.lang.IllegalArgumentException: 为此cookie指定的域[localhost:xxxx]无效

lywJee / 2024-10-10 / 原文

转载:https://blog.csdn.net/weixin_43724845/article/details/116198741

问题原因:

Tomcat 8 更换默认的 CookieProcessor 实现为 Rfc6265CookieProcessor ,之前的实现为 LegacyCookieProcessor 。前者是基于 RFC6265 ,而后者基于 RFC6265、RFC2109、RFC2616 。

解决方式:

修改tomcat的配置文件 context.xml ,指定 CookieProcessor 为 org.apache.tomcat.util.http.LegacyCookieProcessor

 

<Context>
    <CookieProcessor className="org.apache.tomcat.util.http.LegacyCookieProcessor" />
</Context>