I'm building an Backbone.js app to talk to an api that I've also built.
The api sits on api.foo.com website on web.foo.com
Im managed to get CORS working with the appropriate header fields in apache
Header set Access-Control-Allow-Origin "http://web.foo.com"
Header set Access-Control-Allow-Methods "GET,PUT,POST,DELETE,OPTIONS"
Header set Access-Control-Allow-Headers Content-Type
Header set Access-Control-Allow-Credentials "true"
Header append Access-Control-Allow-Headers Origin
Header append Access-Control-Allow-Headers Accept
Header append Access-Control-Allow-Headers X-Requested-With
and setting the xhrFields to
f = { withCredentials: true}
params.xhrFields = f;
// Make the request, allowing the user to override any Ajax options.
$.ajax(params);
this all works with chrome. Im about to do a post to api.foo.com/sessions login, get a cookie and then do another request to api.foo.com with that cookie.
Unfortunately when I switched to firefox 10.0.7, this didnt work. The withCredentials didnt seem to get jquery to pick up the cookie and use it.
Unlike most the questions relating to this on stackoverflow, this is not a one off, I need to get this to work consistently across browsers (I havent even got to IE yet).
Im using
Backbone.js 0.9.1 jquery 1.7.1 require 1.0.7 underscore 1.3.1
Works on
Chrome 17.0.963.65
doesnt work on firefox 10.0.2
Can anybody help me?