Closed Bug 1399291 Opened 7 years ago Closed 7 years ago

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

Categories

(Core :: DOM: Core & HTML, defect)

55 Branch
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1404910

People

(Reporter: post, Unassigned)

Details

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
Looks like http://localhost:46464/ is misinterpreted as secure connection
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
Closed: 7 years ago
Flags: needinfo?(amarchesini)
Resolution: --- → DUPLICATE
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.