Microsoft Edge does not allow loopback localhost for Web sites

I have a website and desktop app and I want to bundle them using websockets. So my website is trying to connect to wss: // localhost: 8080, for example.

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

Cross zone request not allowed

I have this problem on Win10 10240, so the “Allow loopback localhost” flag is enabled by default, and it didn’t help.

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

So, is it true that in the new MS Edge builds loopbacks are allowed for http but not allowed for web sockets? And if so, is it possible to make some workaround, rather than force my users to run some kind of shell or download the externall utility?

Related question: Cannot open localhost in Microsoft Edge (Project Spartan) in Windows 10 Preview

+5
source share
3 answers

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

In short, when you call new WebSocket on MS Edge, it does not throw an exception when you call it with the 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 cannot “retry” to connect to different hosts.

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

+4
source

In the Microsoft Edge browser, enter “About: flags” in the title bar (search bar). No quotes, Check / Uncheck "Allow Local Call".

Edge on Win Build 10240. (still works on line 14393)

+4
source

This happened to me recently after creating the Windows Creator Update (1703).

But it was easy. I had to

  • Check the "Allow Local Binding" feature specified by @Narcarsiss (not sure if this is disabled in the update, or I just never checked it before before).
  • Specify the protocol in the address bar ( http: // localhost: 5000 / , and not just localhost: 5000 /).

After completing both, I was able to access my localhost sites in MS Edge again.

+1
source

All Articles