Angular JS $ http call code returns status code 0

Currently, I came across a strange problem in angular JS when you make an http call. After executing the POST request, after waiting about 2-3 minutes, the call fails, returning:

  • status code 0
  • null response data
  • empty response text

        $.support.cors = true;
        var req = {
            method: 'POST',
            url: serverIp + "UpdateDocumentInventar",
            headers: {
                'codDocument': CodDocument,
                'deviceId': deviceId,
                'authToken': authToken,
                'codGestiune': codGestiune
            },
            timeout: timeoutNR,
            data: articoleChanged   <--- array of items
        }
        var request = $http(req);
    
        return (request.then(handleSuccess, handleError));
    

The web server has not been reached since I put the loggers there to see if there is a problem or not.

I also need to mention that this call does not always fail - sometimes it works, sometimes it is not. (I read on the network that status code 0 is usually associated with not installing CORS - I also installed this, and this is certainly not a problem, as other similar requests are executed correctly).

:  - - http- (60000000)  - HTTP- ( , , 41)

,

+4

Source: https://habr.com/ru/post/1668229/


All Articles