websocket from http://localhost:4444 won't connect to ws://localhost:4444/ws unless network.websocket.allowInsecureFromHTTPS is set to true.

RESOLVED DUPLICATE of bug 1404910

Status

()

Core
DOM
RESOLVED DUPLICATE of bug 1404910
10 months ago
9 months ago

People

(Reporter: post, Unassigned)

Tracking

55 Branch
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

10 months ago
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0
Build ID: 20170826053331

Steps to reproduce:

var wsuri = ((window.location.protocol === "https:") ? "wss://" : "ws://") + window.location.host + "/ws";
sock = new WebSocket(wsuri);

with window.location == http://localhost:46464/


Actual results:

SecurityError: The operation is insecure.


Expected results:

connect
(Reporter)

Comment 1

10 months ago
Looks like http://localhost:46464/ is misinterpreted as secure connection

Updated

10 months ago
Component: Untriaged → Networking: WebSockets
(In reply to post from comment #1)
> Looks like http://localhost:46464/ is misinterpreted as secure connection

I think that's true. We do treat localhost as a secure origin in certain situations, but I think it shouldn't prevent the ws:// connection from working.

http://searchfox.org/mozilla-central/rev/01970ed92d74f82d4e94a1e4365892bbcc593889/dom/base/WebSocket.cpp#1651
Component: Networking: WebSockets → DOM
Flags: needinfo?(amarchesini)
This has been already fixed by bug 1404910
Status: UNCONFIRMED → RESOLVED
Last Resolved: 9 months ago
Flags: needinfo?(amarchesini)
Resolution: --- → DUPLICATE
Duplicate of bug: 1404910
You need to log in before you can comment on or make changes to this bug.