spring跨域配置 allowedOrigins

When allowCredentials is true, allowedOrigins cannot contain the special value "*"since that cannot be set on the “Access-Control-Allow-Origin” response header.

解决

public class WebMvcConfig implements WebMvcConfigurer {
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")
                .allowedOriginPatterns("*")//允许跨域访问的路劲
                。。。
    }
}


版权声明:本文为qq_45453811原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。