/rebateuser/ 为微服务的server.servlet.context-path,cookie的保存路径,其他微服务无法拿到这个cookie;解决方案,1,将/rebateuser/写在每一个Controller的url上,2参考:springboot 不同context-path下的会话共享
@Configuration
public class SessionShareConfig {
@Bean
public CookieSerializer cookieSerializer() {
DefaultCookieSerializer serializer = new DefaultCookieSerializer();
serializer.setCookieName("SESSION");
serializer.setCookiePath("/");
serializer.setDomainNamePattern("^.+?\\.(\\w+\\.[a-z]+)$");
return serializer;
}
}