-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Description
the following code in "lib/socket.io/transports/websocket.js" returns a location header with the 'ws' scheme if the origin is not https, regardless of whether the websocket was opened with a 'wss' scheme:
var origin = this.request.headers.origin,
location = (origin && origin.substr(0, 5) == 'https' ? 'wss' : 'ws')
+ '://' + this.request.headers.host + this.request.url;
i couldn't find anything in the websocket spec that disallows using 'wss' websocket connections from pages server over http, and in chromium this results in:
Error during WebSocket handshake: location mismatch: wss://hostname:port//node.js/realtime/websocket != ws://hostname:port//node.js/realtime/websocket
if i missed something, and the spec doesn't allow this, so be it. if not, i'm happy to work up a patch that allows the websocket data to use a tunnel even if the page html doesn't. (yes, there are use cases for this, as the network the html travels over may be trusted, while the websocket data may use a different, untrusted network.)