forked from socketio/socket.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding configuration variable matchOriginProtocol
matchOriginProtocol is meant to be used when running socket.io behind a proxy. matchOriginProtocol should be set to true when you want the location handshake to match the protocol of the origin. This fixes issues with terminating the SSL in front of Node and forcing location to think it's wss instead of ws.
- Loading branch information
1 parent
220f8d5
commit 6f2270a
Showing
4 changed files
with
11 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
|
||
/*! | ||
* socket.io-node | ||
* Copyright(c) 2011 LearnBoost <[email protected]> | ||
|
@@ -88,7 +89,9 @@ WebSocket.prototype.onSocketConnect = function () { | |
} | ||
|
||
var origin = this.req.headers.origin | ||
, location = (origin.match(/^https/) ? 'wss' : 'ws') | ||
, location = ((this.manager.settings.matchOriginProtocol ? | ||
origin.match(/^https/) : this.socket.encrypted) ? | ||
'wss' : 'ws') | ||
+ '://' + this.req.headers.host + this.req.url | ||
, waitingForNonce = false; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters