源自:3-8 用户模型管理--getotp页面实现
获取OTP短信验证失败,打开网页输入手机号点击获取OTP后出现以下错误求大神解答,谢谢! Access to XMLHttpRequest at 'http://localhost:8090/user/getotp' from origin 'http://localhost:63342' has been blocked by CORS policy: The value of the 'Access-Control-Allow-Origin' header in the response mus
短信发送失败
提问者:weixin_慕仙521292
2019-11-21 10:21
个回答
-
错了
前端ajax内加xhrFields: {withCredentials: false},
是false不是true
这个是携不携带cookie
-
这个是数据跨域出的问题。
contoller注释下面加这个注释@CrossOrigin(origins = {"*"},allowedHeaders = "true")
前端ajax内加xhrFields: {withCredentials: true},