Node js / Angular js - WARNING: preliminary headers are displayed

This is my Angular js part code:

$http({ method:'POST', withCredential:true, url:$scope.config.app_ws+'auth/signup', data:{user:$scope.auth} }).success(function(status, response){ console.log(response); }).error(function(status, response){ alert(response+'Bummer :( , an error occured plese retry later. '); }); 

This is my Node.js snippet:

  var allow_cross_domain= function(req, res, next) { res.header('X-Powered-By', 'hey.heyssssssss.org'); var oneof = false; if(req.headers.origin) { res.header('Access-Control-Allow-Origin', req.headers.origin); oneof = true; } if(req.headers['access-control-request-method']) { res.header('Access-Control-Allow-Methods', req.headers['access-control-request-method']); oneof = true; } if(req.headers['access-control-request-headers']) { res.header('Access-Control-Allow-Headers', req.headers['access-control-request-headers']); oneof = true; } if(oneof) { res.header('Access-Control-Max-Age', 60 * 60 * 24 * 365); } // intercept OPTIONS method if (oneof && req.method == 'OPTIONS') { res.send(200); } else { next(); } } app.use(allow_cross_domain); app.post('/auth/signup', function (req, res) { res.send('wtff'); }); 

I just call POST localhost: 3000 / auth / signup from Angular to Node, but I get **CAUTION : Provisional headers are shown.** in the console is chrome.

Chrome (ATTENTION):

enter image description here

Firefox (NO ANSWERS for 30/60 seconds, and then a warning (): /) appears:

enter image description here

what could it be?

IF I use GET, everything is fine, just with POST, what I get problems, how is this possible?

+5
javascript angularjs
source share
2 answers

personaly I use this reset method in angular:

 app.config(['$httpProvider', function ($httpProvider) { //Reset headers to avoid OPTIONS request (aka preflight) $httpProvider.defaults.headers.common = {}; $httpProvider.defaults.headers.post = {}; $httpProvider.defaults.headers.put = {}; $httpProvider.defaults.headers.patch = {}; }]); 
+10
source share

This was fixed on March 28, 2014, so it will be fine in the next version of crome (v35)

chrome community

+2
source share

All Articles