根据您使用的AngularJS版本,您可能必须在每个$ http上进行设置。
从1.2开始,您可以执行以下操作:
$http.get(url,{ withCredentials: true, ...})从1.1.1起,您可以对其进行全局配置:
config(['$httpProvider', function($httpProvider) { $httpProvider.defaults.withCredentials = true;}]).如果您使用的是Angular的旧版本,请尝试将配置对象传递给指定withCredentials的$ http。应该可以在1.1之前的版本中使用:
$http({withCredentials: true, ...}).get(...)另请参阅mruelans答案和:
- https://github.com/angular/angular.js/pull/1209
- http://docs.angularjs.org/api/ng.$http
- https://developer.mozilla.org/zh-CN/docs/HTTP/Access_control_CORS?redirectlocale=zh-CN&redirectslug=HTTP_access_control#section_5



