$http request doesn't send cookies cross-domain in angular CORS $http request doesn't send cookies cross-domain in angular CORS jquery jquery

$http request doesn't send cookies cross-domain in angular CORS


Have you seen this? Communication between AngularJS and a Jersey Webservice which are on a different domain. Can't access correct session

Try passing a config object to $http that specifies withCredentials, that should work in all versions.

$http({withCredentials: true, ...}).get(...)

And the discussion here: https://github.com/angular/angular.js/pull/1209


Setting withCredentials=true should work, and in particular the part where it does work with $ajax is vexing. It leads me to believe the problem is not in the client, but in a combination of what the server sends back and how you're testing it.

Are you sure you're testing on the same path with both jQuery and Angular?

The problem might be related to the cookie you get back from the server. If the path isn't set correctly, the browser will not send the cookies with the requests to other paths. This goes for other properties as well, but path is most likely.

This is would be unrelated to Angular configuration, but it could set you back a few hours nonetheless.

Other than that the only likely explanation is that you're using an old version of Angular, but given the detail of your question and links to other answers that seems unlikely to me.


I see two different subdomains.

  • admin.vibetrace.com
  • app.vibetrace.com

Try to set the cookie for your main domain explicitly:

Set-Cookie:vibetrace.ssid=...; Domain=.vibetrace.com; Path=/; Expires=...

Reference: Wikipedia: HTTP Cookie - Domain and Path