Angular.js: CORS Error Response Status = 0

Created on 26 May 2013  路  6Comments  路  Source: angular/angular.js

I'm using Angular 1.0.6.

It seems whenever a CORS request fails, the response returned is always 0.

I _am not_ using JSONP.

Most helpful comment

@okonon yes, all server responses must have the CORS headers attached, even 4xx, 5xx responses, so that the browser parses them.

All 6 comments

I'm having this issue as well with the same version: 1.0.6.
Also not using JSONP

@tysonnero @danielzen I'm afraid that this is what we are getting from a browser's XHR object. Closing for now, please reopen if you believe that there are improvements that could be done on AngularJS side in this respect.

I've done a little research and it seems like people are experiencing in the case of the client code handling the response incorrectly or the server not setting the proper headers. I will see if I can remedy this on the server side.

Also, some recommend to migrate to JSONP, but I noticed there is the same issue open for JSONP within Angular.

I'm having the same problem. The server replies with status 401 but my request interceptor says the status is 0.

same issue as @lucassp. Did you ever figure it out?

@okonon yes, all server responses must have the CORS headers attached, even 4xx, 5xx responses, so that the browser parses them.

Was this page helpful?
0 / 5 - 0 ratings