vue跨域cookie问题

前端配置withCredentials =true

vue跨域cookie问题_第1张图片

springboot后端配置

@Bean
public CorsFilter corsFilter() {
   final UrlBasedCorsConfigurationSource urlBasedCorsConfigurationSource = new UrlBasedCorsConfigurationSource();
   final CorsConfiguration corsConfiguration = new CorsConfiguration();
   corsConfiguration.setAllowCredentials(true);
   corsConfiguration.addAllowedOrigin("*");
   corsConfiguration.addAllowedHeader("*");
   corsConfiguration.addAllowedMethod("*");
   urlBasedCorsConfigurationSource.registerCorsConfiguration("/**", corsConfiguration);
   return new CorsFilter(urlBasedCorsConfigurationSource);
}

 

你可能感兴趣的:(vue,cookie,spring)