File tree Expand file tree Collapse file tree 1 file changed +19
-18
lines changed Expand file tree Collapse file tree 1 file changed +19
-18
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,25 @@ class WebSocketClient extends TelnetClient {
71
71
} ) ( ws ) ;
72
72
73
73
super ( wsDuplex ) ;
74
+
75
+ Log . trace ( { headers : req . headers } , 'WebSocket connection headers' ) ;
76
+
77
+ //
78
+ // If the config allows it, look for 'x-forwarded-proto' as "https"
79
+ // to override |isSecure|
80
+ //
81
+ if (
82
+ true === _ . get ( Config ( ) , 'loginServers.webSocket.proxied' ) &&
83
+ 'https' === req . headers [ 'x-forwarded-proto' ]
84
+ ) {
85
+ Log . debug (
86
+ `Assuming secure connection due to X-Forwarded-Proto of "${ req . headers [ 'x-forwarded-proto' ] } "`
87
+ ) ;
88
+ this . proxied = true ;
89
+ } else {
90
+ this . proxied = false ;
91
+ }
92
+
74
93
wsDuplex . setClient ( this , req ) ;
75
94
76
95
// fudge remoteAddress on socket, which is now TelnetSocket
@@ -91,24 +110,6 @@ class WebSocketClient extends TelnetClient {
91
110
ws . isConnectionAlive = true ;
92
111
} ) ;
93
112
94
- Log . trace ( { headers : req . headers } , 'WebSocket connection headers' ) ;
95
-
96
- //
97
- // If the config allows it, look for 'x-forwarded-proto' as "https"
98
- // to override |isSecure|
99
- //
100
- if (
101
- true === _ . get ( Config ( ) , 'loginServers.webSocket.proxied' ) &&
102
- 'https' === req . headers [ 'x-forwarded-proto' ]
103
- ) {
104
- Log . debug (
105
- `Assuming secure connection due to X-Forwarded-Proto of "${ req . headers [ 'x-forwarded-proto' ] } "`
106
- ) ;
107
- this . proxied = true ;
108
- } else {
109
- this . proxied = false ;
110
- }
111
-
112
113
// start handshake process
113
114
this . banner ( ) ;
114
115
}
You can’t perform that action at this time.
0 commit comments