File tree Expand file tree Collapse file tree 3 files changed +31
-1
lines changed Expand file tree Collapse file tree 3 files changed +31
-1
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @epicgames-ps/wilbur ' : minor
3+ ---
4+
5+ Adds command line options to wilbur to allow for configuring the reverse proxy:
6+
7+ --reverse-proxy Enables reverse proxy mode. This will
8+ trust the X-Forwarded-For header.
9+ (default: false)
10+ --reverse-proxy-num-proxies <number > Sets the number of proxies to trust.
11+ This is used to calculate the real
12+ client IP address. (default: 1)
Original file line number Diff line number Diff line change 1414 "ssl_cert_path" : " certificates/client-cert.pem" ,
1515 "https_redirect" : true ,
1616 "rest_api" : false ,
17+ "reverse_proxy" : false ,
18+ "reverse_proxy_num_proxies" : 1 ,
1719 "peer_options" : " " ,
1820 "log_config" : true ,
1921 "stdin" : false ,
2022 "console_messages" : " verbose"
21- }
23+ }
Original file line number Diff line number Diff line change @@ -147,6 +147,19 @@ program
147147 . argParser ( JSON . parse )
148148 . default ( config_file . peer_options || '' )
149149 )
150+ . option (
151+ '--reverse-proxy' ,
152+ 'Enables reverse proxy mode. This will trust the X-Forwarded-For header.' ,
153+ config_file . reverse_proxy || false
154+ )
155+ . addOption (
156+ new Option (
157+ '--reverse-proxy-num-proxies <number>' ,
158+ 'Sets the number of proxies to trust. This is used to calculate the real client IP address.'
159+ )
160+ . implies ( { reverse_proxy : true } )
161+ . default ( config_file . reverse_proxy_num_proxies || 1 )
162+ )
150163 . option (
151164 '--log_config' ,
152165 'Will print the program configuration on startup.' ,
@@ -197,6 +210,9 @@ if (options.log_config) {
197210}
198211
199212const app = express ( ) ;
213+ if ( options . reverse_proxy ) {
214+ app . set ( 'trust proxy' , options . reverse_proxy_num_proxies ) ;
215+ }
200216
201217const serverOpts : IServerConfig = {
202218 streamerPort : options . streamer_port ,
You can’t perform that action at this time.
0 commit comments