0

I have been recently stuck into a strange issue, thrown by a Multi platform Hybrid App in Visual Studio App.. My Development Environment details are as follows :

  1. Visual Studio 2013 Release 3
  2. Cordova 4.0
  3. Angularjs 1.4
  4. Ionic 1.4
  5. Nokia Lumia 1320 [Windows 8.1 OS]

I have a web app that will be interacting with the mobile app, deployed on a server machine that can be accessed both by an internal enterprise network, as well as from internet.

Now the problem is, when i am [the mobile device is] connected to the internal network, the $http call fails with a status code of 0. Internal dig down reveals that the actual returned status code is -1.

However, when i switch over to mobile data in the phone, the ajax call goes smooth and finishes successfully. Now, if i switch back to internal network, it again starts working perfectly. !!!!

The http call is quite simple and uses promise API... I also have some request interceptors.

Any explanations for this strange behavior, or more appropriately a solution for the same ??

Manish Kr. Shukla
  • 4,447
  • 1
  • 20
  • 35

1 Answers1

0

After Scratching my head for over 2 days, i was finally able to conclude that it was my browser that was the culprit.

As i said, i was using Windows Phone 8.1, which uses Internet Explorer 11 as the default rendered. Also, My Web server was actually behind a Proxy Server [Apache HTTP].

Now, the Real problem was that the ajax call was returning response status code as 0. And the reason for that was that The Ajax Call was being suspended by The Apache HTTP Proxy Server, because of some tunneling issue. Please note that this was specifically happening with IE11 and Apache HTTP Server.

This was happening since I was using POST request on a HTTPS Based Proxy Server.

Now the solution is too non-technical, but that's what saved my life. In order to save your life from this issue, You must

1. Either convert your POST Request to GET Request

2. Or Before making a POST Request to the Server, make a GET Request to the same server.

In my case, i went with the second approach and it saved my life. Posting this as answer so that it saves someone else too.

You can refer to the following links for more details.

  1. IE10/IE11 Abort Post Ajax Request After Clearing Cache with error “Network Error 0x2ef3”

  2. Making XHR Request to HTTPS domains with WinJS

Community
  • 1
  • 1
Manish Kr. Shukla
  • 4,447
  • 1
  • 20
  • 35