IE10/11 Ajax XHR error - SCRIPT7002: XMLHttpRequest: Network Error 0x2ef3
Asked Answered
B

10

36

I've been working on this problem for a few days and reaching out on this forum since I feel like I've exhausted my options. I have a form hosted on a Drupal 7 website and need to submit the form values to an external url. The form uses a POST request over the HTTPS protocol via jQuery.AJAX

  • Form works fine in Chrome, Firefox, and Safari
  • I am receiving the following error in IE10+ console (and the ajax call always goes into the error function when using IE10+):

SCRIPT7002: XMLHttpRequest: Network Error 0x2ef3, Could not complete the operation due to error 00002ef3

I've tried the following:

  • adding contentType:

    // causes all of the jQuery callbacks to error out
    "application/json; charset=utf-8",
    
  • attempting an Ajax GET call before the actual POST (as suggested on another SO thread)

  • added header( 'Content-Type: application/json; charset=utf-8' ); to the request

  • set crossDomain: true

The appropriate CORS headers have been added and the form code is pasted below:

$.ajax({
    url: "[URL]", //the page to receive the form data  
    crossDomain: true,
    type: "POST",
    data: dataString, //posting to API 
    dataType: "json", //the data type the function should expect back from the server     
    success: function(data) {         
        if (data.response_status == "1") { //error for at least 1 field
             //display error message 
             }
             else { 
             //display thank you label next to input
             }

        } else {
           //All form fields completed successfully! Redirect user to Thank you confirmation page            
        } 
     },
    error: function(jqXHR, textStatus, errorThrown) {
             alert("there is an error!");
             console.log("in error section");
             console.log("jqXHR: " + jqXHR);
             console.log("jqXHR.responseText: " + jqXHR.responseText);
             console.log("textStatus: " + textStatus);
             console.log("errorThrown: " + errorThrown);
             data = $.parseJSON(jqXHR.responseText);
             console.log("parseJSON data: " + data);                           
    }        
    });         
  });
});

I've read SCRIPT7002: XMLHttpRequest: Network Error 0x2ef3, Could not complete the operation due to error 00002ef3

Any guidance would be helpful! THANKS

Betteanne answered 18/4, 2014 at 0:40 Comment(3)
Thanks for the suggestion! I had been using Live HTTP Headers and Firebug but Fiddler2 is definitely more detailed. What is really interesting is that if I allow Fiddler to decrypt HTTPS traffic, everything WORKS! I get the full request and response back, including the CORS headers and JSON data as expected. As soon as I uncheck the option to decrypt HTTPS or stop capturing traffic (F12) I get the aborted connection again. Any ideas why using Fiddler works? Could there be a problem with the SSL cert on the HTML form side (it isn't expired or anything)?Betteanne
Ah, I just found your blog post! Need to read through all the different scenarios. Thanks for pointing me in the right direction! blogs.telerik.com/fiddler/posts/13-02-28/…Betteanne
@EricLaw, I checked SSLLabs.com and the certificates don't have any errors on both the form/app servers. Also TLSv1.0 (confirmed via Fiddler & SSLLabs), HTTP 1.1, Connection: Keep-Alive are being used. So I'm not sure why the connection is not also aborted when I use Fiddler...have you ran into anything similar? Thank you so much againBetteanne
B
12

The OP provided a WireShark capture showing that the server requested a certificate using the HTTPS CertificateRequest message and the client then immediately FINd the connection.

After configuring the server not to request a client certificate, the problem went away.

Using Fiddler also would make the problem disappear because, unless you configure it to do so, Fiddler will never request a client certificate from the browser.

I'm wondering if only the affected client machine had a matching certificate and/or whether the withCredentials flag on the CORS XHR request is relevant in this scenario.

Bozen answered 23/4, 2014 at 18:52 Comment(9)
Disabling the server's CertificateRequest fixed the problem in IE10/11. Thank you!Betteanne
@EricLaw, can you give a few details how this is done?Epigeous
@Ron: "this" meaning "Disable CertificateRequest"? It depends on the server; in IIS8 it's under the "SSL Settings > Client Certificates" radio buttons.Bozen
@EricLaw, thanks. It is set to Ignore, so I assume this is turned off. Thanks for responding.Epigeous
I am getting this error even though my server does not run in HTTPS mode and it does not request browser certificates.Furgeson
@ThePyroEagle: If that's the case, you should probably open a new question and attach network logs (or share a URL) of exactly what your site DOES send.Bozen
@Bozen Anyway (somehow) I've managed to fix it about an hour after I commented.Furgeson
I unchecked TLS (all versions) and ensured that one of the SSL checkboxes were checked in advanced settings in Internet Explorer. Then the problem went away (self-signed certificate and IISExpress port:44300)Moonseed
In my case, when using IE10 and custom headers, every request gets aborted. I solved this by changing the SSL Settings for Client Certificates to 'Ignore' for my web applicationJagir
N
10

I was seeing this error randomly with IE 8+9+10+11 Ajax calls. All other browsers did not have the problem.

It suppose there was a race-condition between KeepAlive connections. I am using Apache 2.4.7.

With the Apache 2 default settings in /etc/apache2/apache2.conf I was able to reproduce the error about every tenth Ajax call:

KeepAlive On
KeepAliveTimeout 5

Solution: Either setting

KeepAlive off

or

KeepAliveTimeout 1

solved the problem for me. I recommend anyone experiencing the 0x2ef3-Network error to fist set KeepAlive off on the server. If the error is gone, switch it on again and test with the values of KeepAliveTimeout. They can also be set to ms.

There is also a way to disable KeepAlive only for Internet Explorer.

Newsletter answered 6/11, 2015 at 19:19 Comment(3)
0x2ef3-Network error seems to be an umbrella for a couple of problems with HTTP and IE. But one of them is definitely race condition for 2 packages in POST Ajax request producing by IE. At least, turning off KeepAlive on Glassfish or IE solves the problemLonnielonny
I want to point out that this solves my problem. I am using Magento 1.9.0.1 and Apache. Thank you very much!Fiftyfifty
This fix seems to address the issue for one of our sites (woocommerce 2.2.8). It is temporary though: recent versions have addressed this in the code so that is our preferred route once we upgrade.Pike
I
6

In my environment, I first copied/pasted some old codes to take use of. So the "contentType" was "application/json".

When I found out IE11 over windows 8 does NOT work in a very high probability, as long as I clicked submit button using my mouse. But I also found out the if I pressed the enter key in my keyboard, then it works just fine with IE11.

Note that my input elemnts and submit button were nested in a form element.

After struggling for a while, I came to this page, but didn't solve my problem, because I knew nothing about backend technologies. I was just a front-end guy with limited knowledge.

Then I tried a lot of modifications one by one. Suddenly the jQuery official API documents inspired me. I commented out the "contentType" parameter so that the "contentType" takes the default value, which is "application/x-www-form-urlencoded; charset=UTF-8". Then problem is solved.

Hope this will help.

Invoice answered 16/4, 2015 at 6:27 Comment(2)
Thanx! Tried so many suggestion and all I had to do was to remove the contentType parameter... :)Tubby
This will only work if your service is not expecting a formatted object (i.e. a .NET WCF service expects formatted JSON or XML by default).Paigepaik
J
6

I had faced the same issue. For me the issue seemed to be occurring only in IE11 over a Post call, I have been using AngularJS provider $http to make the call. It seems that this is a bug in IE, and it is a certificate issue. The security certificate information is not loaded properly when the POST call is made. As a workaround, before making the POST call, make a GET call to load the certificate properly. Take a look at the example code below (it's using AngularJS)

$http({
    method: "GET",
    url: "/api/DummyGet"
}).success(
$http({
        method: "POST",
        url: "/api/PostCall",
        data: data
})
);

For further information you can take a look at these two links -http://jonnyreeves.co.uk/2013/making-xhr-request-to-https-domains-with-winjs/
-IE10/IE11 Abort Post Ajax Request After Clearing Cache with error "Network Error 0x2ef3"

Jana answered 19/8, 2015 at 22:24 Comment(2)
Almost 4 years later, this works for me in Angular6. Don't forget to wait for the GET request to complete before you make POSTSoemba
Great to hear!!Jana
R
3

I had a similar situation and after much research, the issue was a different one, but I want to post it here in the hopes that someone might find it helpful looking for the same error:

Apache had a connection timeout of 5 seconds. Internet explorer 11 on Win 7 seemed to ignore the fact that there was no active session anymore, assuming it would be 60 seconds. After changing the Apache settings to a timeout of 60 seconds, my issue was resolved.

Rickrack answered 28/11, 2014 at 11:12 Comment(2)
"there was no active session anymore, assuming it would be 60 seconds" It's not clear what exactly you mean by "active session." Any client or server can close a HTTP connection at any time that it's idle, and if a connection is closed the browser will then use a new connection.Bozen
A known bug of IE, IE won't create a new connection for some reasonLonnielonny
L
3

I had this problem with an IIS application, an AJAX Post request that returned some JSON would fail, eventually returning abort, with the:

SCRIPT7002: XMLHttpRequest: Network Error 0x2ef3

error in the console. On other browsers (Chrome, Firefox, Safari) the exact same AJAX request was fine.

Further investigation revealed that the response from the server was missing the status code - in this case it should have been 500 internal error.

This was being generated as part of a C# web application using service stack that requires an error code to be explicitly set.

IE seemed to leave the connection open, eventually the network layer closed it and it 'aborted' the request; despite receiving the content and other headers.

Updating the web application to correctly return the status code fixed the issue.

Perhaps there is an issue with how IE is handling the headers in posts.

Hope this helps someone!

Lactation answered 22/9, 2015 at 1:23 Comment(0)
P
2

Well, I received same error on IE 11. Trying to describe what was causing it as short as possible.

  • showing site as http
  • the site makes ajax call to https
  • the ssl was self signed, but browser had no exception for it yet.
  • After the certificate exception was created, everything works fine.

Hope that helps someone.

Preceptor answered 23/2, 2016 at 3:17 Comment(1)
Thanks so much, this helped me after having spent hours on this :)Delitescent
E
1

I had this same error in ASP.NET MVC and was finally able to get around it. I was generating a couple of hundred embedded forms in the page with each having @Html.AntiForgeryToken() . I believe this results in creating a cookie on the client side. Potentially IE was running out of space for the cookies (or something, who knows with IE). Removed it and my problem went away.

Epigeous answered 1/5, 2014 at 15:14 Comment(0)
H
1

We were seeing the same error in IE11 and Edge. A jQuery AJAX request was throwing the error XMLHttpRequest: Network Error 0x2ef3, Could not complete the operation due to error 00002ef3. consistently after exactly 300s. (Chrome & Firefox were fine)

Turned out to be an idle timeout setting on our load balancer (F5 in our case). We managed to diagnose the issue using Fiddler, which resulted in a more helpful error message in the browser: Failed to load resource: the server responded with a status of 504 (Fiddler - Receive Failure) Note that with Fiddler running, we saw this error (after 300s) in all browsers, including Chrome and Firefox.

Hydromel answered 27/1, 2017 at 11:57 Comment(2)
Did you change the timeout on F5?Unspotted
We also use F5 as our load balancer. We're getting this error while posting a simple /refresh to the web application. I cannot reproduce the error on my local host. But I can in other environments where we use F5. And it only happens in IE11. What did you set the idle timeout value to in the end? --thanks.Vano
T
0

Just want to give my take on what was the root cause of this issue for me.

We have an Angular2 app, that is calling our NodeJS REST api. The rest API then calls another service (SOAP I believe).

We found out that our SOAP service did not have the endpoint(?) in only one environment (worked everywhere else). When the NodeJS api was calling the SOAP service, the soap service was returning an error saying 'X is not a function'. When the error response was returned to NodeJS, it did not have the proper error/exception handling, so it was completely killing the service. Thus, the UI was not getting a response.

Tieshatieup answered 25/5, 2017 at 13:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.