跨域

@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Profile("dev")
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")
                .allowedHeaders("*")
                .allowedMethods("*")
                .allowedOrigins("*")
                .allowCredentials(false);
    }

 SpringBoot中使用Spring Security,需要在WebSecurityConfigurerAdapter和WebMvcConfigurer中同时开启跨域

https://www.codeleading.com/article/33234794762/

SpringBoot解决跨域的几种方案

https://whhtjl.blog.csdn.net/article/details/112313180

Access-Control-Allow-Credentials为true时Access-Control-Allow-Origin必须指定一个确定的域名

https://blog.csdn.net/qq_19457117/article/details/107448558

 

posted @ 2021-09-05 13:12  tonggc1668  阅读(30)  评论(0编辑  收藏  举报