1、前端ajax
$.ajax({
url: url,
type: 'post',
xhrFields: {withCredentials:true}, //前端适配:允许session跨域
crossDomain: true,
data: data,
success: function(data) {
}
});
ajax加上这两句
xhrFields: {withCredentials:true}, //前端适配:允许session跨域
crossDomain: true,
2、后台
@CrossOrigin(allowCredentials="true",allowedHeaders="*")