为了账号安全,请及时绑定邮箱和手机立即绑定

Access to XMLHttpRequest at 'http://localhost:8080/user/getotp' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

试了大家提的方法了,前端浏览器发起请求还是报跨域的错。后端接口用postman测试是🆗的。呜呜呜~

正在回答

1 回答

对不起,是我大意了。我发现我后端写成了getopt,前端请求的却是getotp~~我现在可以正确发送验证码了。然后我做的唯一修改就是:

@CrossOrigin(allowCredentials = "true",allowedHeaders = "*", originPatterns ="*")


1 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

Access to XMLHttpRequest at 'http://localhost:8080/user/getotp' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信