[英]$http GET doesn't send JSESSIONID in chrome but works on firefox angularjs
so I have this code 所以我有这个代码
$http({
'method': 'GET',
'url': 'http://www.example.com',
'withCredentials': true,
headers: {
'Content-type': 'application/json'
}
}).
success(function (data, response, headers, status) {
});
This will return with the JSON array of records, well the http request is using credentials which is a JSESSIONID that use for every consecutive calls to the backend. 这将返回记录的JSON数组,以及http请求正在使用凭据,该凭据是一个JSESSIONID,用于对后端的每次连续调用。
The problem is, it works on firefox but doesn't on chrome. 问题是,它可以在Firefox上运行,但不能在chrome上运行。 So firefox does send the cookies containing the JSESSIONID but not chrome while I already set the withCredentials
to true
所以在我已经将withCredentials
设置为true
firefox确实发送了包含JSESSIONID而不是chrome的withCredentials
。
Why does this happen? 为什么会这样?
This is the CORS exception, when you are trying to load data from another domain that giving you error, more about CORS . 这是CORS例外,当您尝试从另一个会给您带来错误的域中加载数据时, 更多关于CORS的信息 。
And also check my answer how to enable CORS on angular js, but unfortunately your server also must enable CORS. 并检查我的答案如何在angular js上启用CORS,但是不幸的是,您的服务器还必须启用CORS。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.