码迷,mamicode.com
首页 > 编程语言 > 详细

Spring Boot报错:java.lang.IllegalArgumentException: An invalid character [..] was present in the Cookie value

时间:2020-01-28 09:15:11      阅读:80      评论:0      收藏:0      [点我收藏+]

标签:local   服务器   doc   enc   set   expec   exception   问题:   factor   

原因及解决办法:https://docs.spring.io/spring-boot/docs/2.0.3.RELEASE/reference/htmlsingle/#howto-use-tomcat-legacycookieprocessor

@Configuration
public class CookieConfig {
 
    /**
     * 解决问题:
     * There was an unexpected error (type=Internal Server Error, status=500).
     * An invalid domain [.localhost.com] was specified for this cookie
     *
     * @return
     */
    @Bean
    public WebServerFactoryCustomizer<TomcatServletWebServerFactory> cookieProcessorCustomizer() {
        return (factory) -> factory.addContextCustomizers(
                (context) -> context.setCookieProcessor(new LegacyCookieProcessor()));
    }
}

补充cookie坑,同一个服务器,前端访问IP地址cookie存在IP地址下,访问域名cookie存在域名下

Spring Boot报错:java.lang.IllegalArgumentException: An invalid character [..] was present in the Cookie value

标签:local   服务器   doc   enc   set   expec   exception   问题:   factor   

原文地址:https://www.cnblogs.com/yxmhl/p/12237343.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!