-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Labels
Description
Neuro currently assumes unencrypted connections, which will prevent connecting from a client served via https to an unencrypted server:
neuro/src/neuro-app/neuro-app.html
Line 242 in a45010c
| this.websocket = new WebSocket(`ws://${this.hostname}:${this.port}`); |
Expected error message in Chrome:
neuro-app.html.js:85 Mixed Content: The page at 'https://...' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://...'. This request has been blocked; this endpoint must be available over WSS.
There's probably a more elegant way to fix this, but my quick fix for connecting to a Heroku dyno is to switch to wss based on the port:
- this.websocket = new WebSocket(`ws://${this.hostname}:${this.port}`);
+ let protocol = (this.port == 443 ? 'wss' : 'ws');
+ this.websocket = new WebSocket(`${protocol}://${this.hostname}:${this.port}`);