Microsoft Edge does not allow localhost loopback for websockets

azaviruha

I have web-site and desktop application, and I want to connect them by websockets. So my web-site tries to connect to wss://localhost:8080, for example.

It works in IE11, but in "MS Edge" I have an error:

Cross zone request is not allowed

I have this problem on Win10 10240, so the flag "Allow localhost loopback" is enabled by default, and it did not help.

When I use CheckNetIsolation LoopbackExempt -a -n="Microsoft.MicrosoftEdge_8wekyb3d8bbwe" or this utility, all works as expected.

So, is this a case, that in new builds of "MS Edge" loopbacks are allowed for http, but not allowed for websockets? And if so, is it possible to make some workaround, and not to force my users to run some shell comand or to download externall utility?

Related question: Can't open localhost in Microsoft Edge (Project Spartan) in Windows 10 preview

azaviruha

After some research I found the source of error. Here is my repo, to reproduce error: https://github.com/AZaviruha/ms-edge-ws-strange

In short, when you call new WebSocket in MS Edge, it does not generate exception, when you call it with wrong "local"-host argument:

var socket, path;
var hosts = ['localhost', '127.0.0.1'];

for (var i in hosts) {
    path = 'ws://'+hosts[i]+':9446';
    console.log( '===> Tested path :: ', path );
    try {
        socket = new WebSocket( path );
        break;
    }
    catch ( e ) {
        // !!! Never shown !!!
        console.error( '===> WebSocket creation error :: ', e );
    }
}

Because of this, you can't "retry" to connect with different hosts.

By the way, if you try non-local non-existent host, it will generate exception!

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Why does App Engine Flexible Enviroment not allow WebSockets and HTTP/2 traffic?

localhost works in Edge but not in Chrome

Can't open localhost in Microsoft Edge (Project Spartan) in Windows 10 preview

Windows Authentication in Microsoft Edge (Spartan) Does Not Prompt for Credentials

Does Microsoft Edge support userscripts?

CSS word-break does not work correctly in Microsoft edge

Does RTCPeerConnection work in Microsoft Edge?

Does Microsoft Edge support aria live regions?

Microsoft Edge not displaying <iframe>

How long does it take for the approval of an Microsoft Edge extension?

Why does opening Microsoft Edge dev tools reload the current page?

Why does Microsoft Edge have a url here

beforeunload in Microsoft Edge not firing

Microsoft Edge WebView2 - Error: The type or namespace name 'Web' does not exist in the namespace 'Microsoft'

Microsoft Edge redirects http://localhost to https://localhost

Does Microsoft C compiler allow variable sized arrays?

Microsoft Edge allow-insecure-localhost flag removed in Version 88.0.705.50

Microsoft Edge on Linux

Why does Microsoft not allow unsigned themes in Windows

Websockets on localhost wihout SSL

Microsoft Edge does not open/read online PDFs

Window.opener in Microsoft Edge undefined when running at localhost

Does “Microsoft Edge” and "Internet Explorer" use the same proxy settings?

Does "loopback" in a loopback file mean the same as in loopback IP address?

Does Microsoft have any email markup that allow users to execute actions?

Access-Control-Allow-Methods and Microsoft Edge, works with Firefox and Chrome

Microsoft Edge Websockets: "SCRIPT12030" error after 30secs

Visibility hidden does not work on Microsoft Edge with CSS content: url();

Microsoft graph API Java HTTP client does not allow updating by patch