1.跨域问题
在配置类中添加
/*跨域问题*/
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("*")
.allowedMethods("GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS")
.allowCredentials(true)
.maxAge(3600)
.allowedHeaders("*");
}
2.sessionid每次不同问题
前端
// 允许携带cookie
axios.defaults.withCredentials = true
后端
就是上边添加的那个
.allowCredentials(true)
版权声明:本文为weixin_42408648原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。