Hi Sander, My $httpProvider configuration:
App.config(['$httpProvider', function ($httpProvider) { $httpProvider.defaults.useXDomain = true; //$httpProvider.defaults.headers.common = {}; console.log('logging out headers'); console.log($httpProvider.defaults); console.log($httpProvider.defaults.headers.common); console.log($httpProvider.defaults.headers.post); console.log($httpProvider.defaults.headers.put); console.log($httpProvider.defaults.headers.patch); console.log('end logging out headers'); $httpProvider.defaults.headers.common = {Accept: "application/json, text/plain, */*"}; $httpProvider.defaults.headers.post = {"Content-Type": "application/json;charset=utf-8"}; console.log('after: logging out headers'); console.log($httpProvider.defaults.headers.common); console.log($httpProvider.defaults.headers.post); console.log($httpProvider.defaults.headers.put); console.log($httpProvider.defaults.headers.patch); console.log('after: end logging out headers'); $httpProvider.interceptors.push(function ($location, $injector) { return { 'request': function (config) { console.log('in request interceptor!'); var path = $location.path(); console.log('request: ' + path); //injected manually to get around circular dependency problem. var AuthService = $injector.get('AuthService'); console.log(AuthService); console.log(config); if (!AuthService.isAuthenticated() && $location.path() != '/login') { console.log('user is not logged in.'); $location.path('/login'); } //add headers console.log(config.headers); return config; } }; }); }]); Where the $http.post call is made: App.services.factory('AuthService', function ($http, $location, $q) { var currentUser; return { authenticate: function (email, password) { //promise to return var deferred = $q.defer(); var authRequest = $http.post('https://' + $location.host() + ':3001/authenticate', {email: email, password: password}); authRequest.success(function (data, status, header, config) { currentUser = data; console.log('currentUser in service set to:'); console.log(currentUser); //resolve promise deferred.resolve(); }); authRequest.error(function (data, status, header, config) { console.log('authentication error'); console.log(status); console.log(data); console.log(header); console.log(config); //reject promise deferred.reject('authentication failed..'); }); return deferred.promise; }, isAuthenticated: function () { return currentUser !== undefined; } }; }); On Thu, Dec 19, 2013 at 11:55 AM, Sander Elias <sanderel...@gmail.com>wrote: > Hi Shaun, > > Did you try a debugging proxy? like http://fiddler2.com/ or > http://httpkit.com/wiretap or http://www.charlesproxy.com/ > Those will help you track down the problem. I highly doubt that this is an > AngularJS issue. Perhaps you somehow have stumbled upon a browser issue, > but most of the times this kind of problem lies in the communication/server > realm. > > Can you reproduce your problem inside a plunk? If you, I'm happy to take a > look at it. > > Regards > Sander > > -- > You received this message because you are subscribed to a topic in the > Google Groups "AngularJS" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/angular/cABqZw7SHYo/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > angular+unsubscr...@googlegroups.com. > To post to this group, send email to angular@googlegroups.com. > Visit this group at http://groups.google.com/group/angular. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/groups/opt_out.