Merge branch 'master' of ssh://numinibsd/git/base/enigma-bbs
This commit is contained in:
commit
5b3fed7135
|
@ -28,6 +28,8 @@ function WebSocketClient(ws, req, serverType) {
|
||||||
get : () => ('secure' === serverType || true === this.proxied) ? true : false,
|
get : () => ('secure' === serverType || true === this.proxied) ? true : false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const self = this;
|
||||||
|
|
||||||
//
|
//
|
||||||
// This bridge makes accessible various calls that client sub classes
|
// This bridge makes accessible various calls that client sub classes
|
||||||
// want to access on I/O socket
|
// want to access on I/O socket
|
||||||
|
@ -48,7 +50,7 @@ function WebSocketClient(ws, req, serverType) {
|
||||||
|
|
||||||
get remoteAddress() {
|
get remoteAddress() {
|
||||||
// Support X-Forwarded-For and X-Real-IP headers for proxied connections
|
// Support X-Forwarded-For and X-Real-IP headers for proxied connections
|
||||||
return (this.proxied && (req.headers['x-forwarded-for'] || req.headers['x-real-ip'])) || req.connection.remoteAddress;
|
return (self.proxied && (req.headers['x-forwarded-for'] || req.headers['x-real-ip'])) || req.connection.remoteAddress;
|
||||||
}
|
}
|
||||||
}(ws);
|
}(ws);
|
||||||
|
|
||||||
|
@ -81,6 +83,8 @@ function WebSocketClient(ws, req, serverType) {
|
||||||
{
|
{
|
||||||
Log.debug(`Assuming secure connection due to X-Forwarded-Proto of "${req.headers['x-forwarded-proto']}"`);
|
Log.debug(`Assuming secure connection due to X-Forwarded-Proto of "${req.headers['x-forwarded-proto']}"`);
|
||||||
this.proxied = true;
|
this.proxied = true;
|
||||||
|
} else {
|
||||||
|
this.proxied = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// start handshake process
|
// start handshake process
|
||||||
|
|
Loading…
Reference in New Issue