Network Error 12152: WebSockets in Edge and IE 11 - javascript

I have a site using websockets secure (WSS) and works very well in chrome.
Testing in IE and Edge also works however in the browser console I get Network Error 12152 which will also trigger the websocket.addEventListener("error",function(){}) if implemented.
Everything actually works I just get this error which doesnt seem to break anything.
Error is triggered When socket is closed from Browser Side
Headers in EDGE
More Info: Example of the code I use
//connect via wss then
ws.addEventListener("error",function(event){ // this hits when Socket is closed})
ws.addEventListener("open",function(){
ws.addEventListener("message",function(event){
//do stuff
ws.Close()
})
})
To Confirm the problem further
I went to https://www.websocket.org/echo.html in edge the site which has the ability to test websocket connections. I made it connect to my server. which opens the connection without a problem. However in just the same way I have been getting problems with my code. This site also throws an error when I click the disconnect button. See Image Below. Is this a bug in IE/Edge?
My Server isnt disconnecting correctly?
I use the above site with the default destination (Their websocket server) and not mine. There are no errors. But when connecting to mine on disconnect there are errors.
What could be the problem?
Thanks

Looking at the Microsoft KB article you are not givng back the expected response/headers on connection setup
From the microsoft knowledge base
12152 ERROR_HTTP_INVALID_SERVER_RESPONSE
The server response could not be parsed.
From the developper docs of mozilla if you look at the Server Handshake Response part
When it gets this request, the server should send a pretty odd-looking (but still HTTP) response that looks like this (remember each header ends with \r\n and put an extra \r\n after the last one):
HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=
So, I suggest you check your headers and see which responses you are sending on the handshake, so you keep in line with protocols.

I have fixed the same error in IE browsers. Check the capitalization of the first letter of websocket.
Non IE browser:
Upgrade: **w**ebsocket
IE browser:
Upgrade: **W**ebsocket

Related

Web application using websockets “Could not establish connection. Receiving end does not exist."

Java server, javascript client, no special libraries, plain text HTTP/1.1 and websocket connections.
Server side written (in Eclipse) using JDK 16 and a websocket jar found in Tomcat, version 10.0.2. (Many permutations of other JDKs and websocket jars have also been tried.)
Two web applications. Tomcat 10.0.2 on PC, 10.0.7 on server. Both apps run on Windows 10. Deployed to a Ubuntu 20.04 server. Both programs display the initial HTTP data. One program gets a websocket connection and works, the other fails to get the websocket connection. Both use the same code to calculate the target URL for the websocket connection:
window.onload = function() {
var target = "ws://" + location.host + "/[context]/[endpoint]";
console.log("target: " + target);
try {
if ('WebSocket' in window) {
socket = new WebSocket(target);
} else if ('MozWebSocket' in window) {
socket = new MozWebSocket(target);
} else {
alert('WebSocket is not supported by this browser.');
return;
}
} catch (e) {
console.log("websocket connection exception: " + e.description);
}
...
Where only [context] and [endpoint] differ. Recall that these URLs work on a PC. I believe they are “well-formed”/valid.
Results for the web app that fails:
Firefox:
uncaught exception: Could not establish connection. Receiving end does not exist.
GET ws://35.xxx.xx.xx:8080/Memory/MemoryEndpoint[HTTP/1.1 404 70ms]
Firefox can’t establish a connection to the server at ws://35.xxx.xx.xx:8080/Memory/MemoryEndpoint.
Chrome:
Error handling response: TypeError: Cannot read property 'encrypt' of undefined
at Object.13 (chrome-extension://bkdgflcldnnnapblkhphbgpggdiikppg/public/js/content-scripts/autofill.js:1427:33)
. . .
game.js:31 WebSocket connection to 'ws://xxx.xx.xx.xx:8080/Memory/MemoryEndpoint' failed:
Chrome continues for many lines regarding the 'encrypt' undefined issue. I have no idea what that is about but it might be very relevant. The last line above implies that some reason for the failure might be given on the next line, but it is empty.
Neither browser logs the expected exception text beginning with: "websocket connection exception:".
Tomcat log files are all clean except for some curious entries in localhost__access_log such as:
209.90.225.218 - - [11/Jul/2021:00:43:33 +0000] "HEAD /robots.txt HTTP/1.0" 404 -
And others mentioning /invoker/readonly, /login, /jenkins/login, /nifi/.
The fact that both programs do return results from the Tomcat server tells me that permissions on ports etc are all sufficient. I've also dug into netstat results and the like, reviewed firewall settings, read many many articles and requests for help. (Probably irrelevant because Tomcat does return expected HTTP/1.1 data.) No luck.
I need this program to work. I would pay a cash reward for a solution to this by 07-16-2021, though I don't know how to discretely negotiate that. :-(
Problem resolved, though I don't understand the cause. Recall: the web application ran fine on development PC deployed to Tomcat version 10.0.2, for various JDKs, websocket libraries (including one found in the Tomcat 10.0.7 that had been installed on the VM). The app failed on the Ubuntu VM. A friend installed Tomcat 10.0.8 in the VM. Presto! websockets work.

wordpress ajax-admin.php aborted on mozilla, works on chrome

I am having real problems with mozilla to show corectly masonry grid gallery on frontend.
While Chrome loads photos corectly through admin-ajax.php mozilla won't.
Here is my page.
EDITED OUT as its not needed anymore.
when you open it in chrome its fine and working no problems all admin-ajax.php posts get responses and loaded fine.
In mozilla I found that admin-ajax.php says ABORTED on the requests but can't find reason why.
POST admin-ajax.php Aborted xxxxx.cz 0 B xx.xx.xx.xx:443
Can anyone help me to find why firefox aborting those requests ?
EDIT:
Found maybe source of the problem but don't know how to fix it.
In firefox I was able to modify header of the request and I did find that Firefox is not sending parameter ACCEPT LANGUAGE correctly.
Accept-Language: cs,en-US,cs;q=0.8,en;q=0.6
But chrome sending language correctly
Accept-Language: cs-CZ,cs;q=0.8,en;q=0.6
I did modify header in firefox to cs-CZ and since then firefox did receive response from apache.
So question now is how to make Firefox to send correct language for accept language or how to make server to send him response even on en-US request ?
This was problem with mod_spdy and php5 module in apache2.
Fixed it with disabling php5 mod and enabled mod_fcgid instead according to this article.
https://developers.google.com/speed/spdy/mod_spdy/php

Edge DTLS Handshake fails to complete (ORTC)

I'm trying to use Edge's ORTC in order to have real-time communication with other web browsers. I've successfuly made this work using peer-to-peer connections but I'm having problems after adding a gateway in between.
The DTLS handshake for some reason fails when I start the call using Edge (controlling), I've turn on wireshark to see if any DTLS messages were being executed but none was "sniffed" (this can be an wireshark issue though). If I answer from Edge (controlled) the connection works (even with the gateway in between).
It's important to notice that the ICE Connection is successfuly established in every case, it seems that by some reason Edge doesn't initiate the DTLS handshake and I can't understand what is the trigger point (I even get the "checking" status on the "ondtlsstatechange" event for the dtls transport object). After about 30 seconds the failed event triggers!
Someone else is having this problem? What could be creating this issue?
Thanks..
I've found a solution..
Well, basically my Gateway was a passive peer and I was starting the DTLS transport with the role "auto", and since the Edge was the "controlling" it automatically sets it as a "server". So basically both ends were "servers" and no DTLS Handshake was being sent. Setting the remote role as "server" solved the issue :)
remoteDtlsParameters.role = "server";
dtlsTransport.start(remoteDtlsParameters);
More info about the remote parameters can be found here:
https://msdn.microsoft.com/en-us/library/mt502488(v=vs.85).aspx

Why are my custom headers giving an "Adapter operation failed" error?

Aloha! Today, I'm trying to add custom headers to each request to my backend.
Playing with my DS.RESTAdapter, I already tried:
The 3 headers: solutions suggested in the official guide.
The 2 ajax: approaches proposed around there.
And 2 jQuery workarounds (based on $.ajaxPrefilter and $.ajaxSetup) that I found there.
Until now, my only result was this very obscure "Adapter operation failed" error:
{
details: "",
status: 0,
title: "The backend responded with an error"
}
I know that:
My backend behaves well and returns a 200 status (I tested sending the request via cURL).
Strangely, removing my adapter's host setting allows the request to be sent, but obviously at the wrong URL.
My problem is not a CSP issue as I'm currently running both backend & frontend locally.
According to my debugging and to my Network Inspector tab, the AJAX request is just never sent (XHR.readyStatus is stuck at 0).
Has somebody already faced this?
Any help would be really lovely!
Ember 1.13.11
Ember Data 1.13.15
jQuery 1.11.3
EDIT: Magic minimal app reproducing the bug is out here!
Hope you'll enjoy it! And because I love you so much, I also offered a demo API endpoint on my server. Details in the FM!
BONUS! Do you know what is the coolest thing to put in a clipboard?
git clone https://github.com/imbrou/ember-data-headers-demo.git
Yeeeeeeha! (-:
Usually "Adapter operation failed" error occurs because your application is having problems connecting to the backend, usually DS.RESTAdapter is not correctly setup, make sure your host and namespace are correct.
Example:
export default DS.RESTAdapter.extend({
host: 'http://193.137.170.210:8080',
namespace: '/api'
});
Solved !
My backend was not sending the correct CORS headers.
The tricky thing is that for an unknown reason, my version of Firefox (Developer Edition...) didn't display the failing OPTIONS request in my Network Inspector at the point of my debugging. I thus had no debugging information at all there.
I could only observe the failing preflight using... Wireshark !
It may have been a bug solved in a Christmas update, as I can't reproduce it today. Too bad...
Anyway, in desperation, I linked 3 screenshots:
No-preflight example: no backend security (no "authorization" token).
Working example: the "authorization" header is requested by client, and allowed by server in the response during the preflight.
Failing example: the "authorization" header is requested by the client, BUT not allowed by the server.
Hope it helps, thanks #Vítor for your support !

chrome getting new Error during WebSocket handshake

have node.js websockets running through haproxy, and has been running successfully for several months.
now now giving error
Error during WebSocket handshake: 'Connection' header value is not 'Upgrade'
same code / setup is still working on development computer
any ideas / suggestions more than appreciated!
firefox works ok! chrome errors from main server, but works correctly local
There is something terribly concerning here with this error message. The "Connection" header value should not be "Upgrade" but should contain "Upgrade". "Connection" is an HTTP header field which is hop-by-hop and may contain multiple tokens, including Upgrade, but also a number of other ones. This is in RFC6455 page 17 :
" 5. The request MUST contain an |Upgrade| header field whose value MUST include the "websocket" keyword."
So I think that something is wrong in the server software, or at least in the error message. You should definitely take a network capture to be sure.

Categories

Resources