spring security跨域问题

1,添加如下代码

http.cors().and().csrf().disable().authorizeRequests()
                //处理跨域请求中的Preflight请求
                .requestMatchers(CorsUtils::isPreFlightRequest)
                .permitAll()

注意,加载最前面不能加在anyrequest后面

猜你喜欢

转载自blog.csdn.net/weixin_38019299/article/details/107192987
今日推荐