88aa
2019-04-25 20:43
后端添加代码
@CrossOrigin(allowCredentials="true",allowedHeaders="*")
前端页添加代码
xhrFields:{withCredentials:true},
添加后本来已经解决的跨域问题又出现了:
getotp.html:1 Failed to load http://localhost:8090/user/getotp: The 'Access-Control-Allow-Origin' header has a value 'null' that is not equal to the supplied origin. Origin 'null' is therefore not allowed access.
有人遇到相同问题吗?
前端有加这个吗?
contentType:"application/x-www-form-urlencoded"
public static final String CONTNET_TYPE_FORMED = "application/x-www-form-urlencoded";
后端:
@RequestMapping(value = "/getotp", method = {RequestMethod.POST}, consumes = {CONTNET_TYPE_FORMED})
@ResponseBody
SpringBoot构建电商基础秒杀项目
49020 学习 · 954 问题
相似问题