Reputation: 377
I have a script which uses websocket on loopback. Since website is served over the internet and websocket over intranet, I observe "SCRIPT12017: WebSocket Error: SECURITY_ERR, Cross zone connection not allowed" in Microsoft Edge. I observe similar problem in Internet explorer as well. IE and MS Edge categories URLs into different zones, each with unique privileges and hence does not allow cross zone connections.
Can I solve this by enabling CORS (Cross Origin Resource Sharing) or CORS works only for different origins from same zone. Or is there any other solution to this problem without altering any settings on the client device?
Upvotes: 3
Views: 4394
Reputation: 821
This may not answer your question, but useful for others.
Here are 2 changes that helped me fix the issue and establish a localhost WebSocket connection.
Upvotes: 0
Reputation: 3577
When you instantiate socket.io in your browser js, use 127.0.0.1 instead of localhost.
const socket = io("http://127.0.0.1:3000");
instead of
const socket = io("http://localhost:3000");
Upvotes: 0
Reputation: 689
you may find the answers here
Microsoft Edge does not allow localhost loopback for websockets
Or you may run this on your command prompt
CheckNetIsolation LoopbackExempt -a -n="Microsoft.MicrosoftEdge_8wekyb3d8bbwe"
Upvotes: 1