springboot 访问时 403 错误


1. 403是被服务器拒绝了,一般是spring security造成的,springsecurity会开启跨域认证,所以不关闭这个的话会访问api会出现403错误

 

2.解决

@Override
    protected void configure(HttpSecurity http) throws Exception {
        http
            
            .and()
            .csrf()
            .disable()
....

在spring security 的控制类中加入以下代码即可,关闭跨域认证.


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM