源自:3-11 用户模型管理--用户注册功能实现02
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测试是🆗的。呜呜呜~
提问者:慕虎0442353
2021-09-09 22:05
个回答
-
对不起,是我大意了。我发现我后端写成了getopt,前端请求的却是getotp~~我现在可以正确发送验证码了。然后我做的唯一修改就是:
@CrossOrigin(allowCredentials = "true",allowedHeaders = "*", originPatterns ="*")