前端又有跨域問題
后端添加代碼
@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.
有人遇到相同問題嗎?
2019-04-26
前端有加這個嗎?
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