Posted
Filed under JSP, JAVA
[참고]https://jistol.github.io/java/2017/08/30/tomcat8-invalid-domain/
--------------------------
java.lang.IllegalArgumentException: An invalid domain [.xxxx.com] was specified for this cookie
과 같이 서브도메인 쿠키 생성시 아래와 같이 처리 해줘야 함.

tomcat context.xml에 다음과 같이 추가
<CookieProcessor className="org.apache.tomcat.util.http.LegacyCookieProcessor"/>

spring boot embead 일경우
@Bean
public EmbeddedServletContainerCustomizer tomcatCustomizer() {
    return container -> {
        if (container instanceof TomcatEmbeddedServletContainerFactory) {
            TomcatEmbeddedServletContainerFactory tomcat = (TomcatEmbeddedServletContainerFactory) container;
            tomcat.addContextCustomizers(context -> context.setCookieProcessor(new LegacyCookieProcessor()));
        }
    };
}

2020/04/06 10:02 2020/04/06 10:02