mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-06-12 07:34:41 +02:00
X-Forwarded-Proto isSecure override option
This commit is contained in:
parent
74bab3d6c5
commit
385edc0953
1 changed files with 14 additions and 1 deletions
|
@ -25,7 +25,7 @@ const ModuleInfo = exports.moduleInfo = {
|
||||||
function WebSocketClient(ws, req, serverType) {
|
function WebSocketClient(ws, req, serverType) {
|
||||||
|
|
||||||
Object.defineProperty(this, 'isSecure', {
|
Object.defineProperty(this, 'isSecure', {
|
||||||
get : () => 'secure' === serverType ? true : false,
|
get : () => ('secure' === serverType || true === this.secureProxyConnection) ? true : false,
|
||||||
});
|
});
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -69,6 +69,19 @@ function WebSocketClient(ws, req, serverType) {
|
||||||
|
|
||||||
TelnetClient.call(this, this.socketBridge, this.socketBridge);
|
TelnetClient.call(this, this.socketBridge, this.socketBridge);
|
||||||
|
|
||||||
|
Log.trace( { headers : req.headers }, 'WebSocket connection headers' );
|
||||||
|
|
||||||
|
//
|
||||||
|
// If the config allows it, look for 'x-forwarded-proto' as "https"
|
||||||
|
// to override |isSecure|
|
||||||
|
//
|
||||||
|
if(true === _.get(Config, 'loginServers.webSocket.secureProxy') &&
|
||||||
|
'https' === req.headers['x-forwarded-proto'])
|
||||||
|
{
|
||||||
|
Log.debug(`Assuming secure connection due to X-Forwarded-Proto of ${req.headers['x-forwarded-proto']}`);
|
||||||
|
this.secureProxyConnection = true;
|
||||||
|
}
|
||||||
|
|
||||||
// start handshake process
|
// start handshake process
|
||||||
this.banner();
|
this.banner();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue