java|使用shiro前后端分离时,获取不到session

【java|使用shiro前后端分离时,获取不到session】前端必须要在ajax请求里加上xhrFields: {withCredentials: true}, crossDomain: true。

$.ajax({ url: xxx/xxx // 将XHR对象的withCredentials设为true xhrFields: { withCredentials: true }, crossDomain: true });

    推荐阅读