@@ -59,6 +59,7 @@ if (argv.h || argv.help) {
5959 '' ,
6060 ' -P --proxy Fallback proxy if the request cannot be resolved. e.g.: http://someurl.com' ,
6161 ' --proxy-options Pass options to proxy using nested dotted objects. e.g.: --proxy-options.secure false' ,
62+ ' --websocket Enable websocket proxy' ,
6263 '' ,
6364 ' --username Username for basic authentication [none]' ,
6465 ' Can also be specified with the env variable NODE_HTTP_SERVER_USERNAME' ,
@@ -84,6 +85,7 @@ var port = argv.p || argv.port || parseInt(process.env.PORT, 10),
8485 sslPassphrase = process . env . NODE_HTTP_SERVER_SSL_PASSPHRASE ,
8586 proxy = argv . P || argv . proxy ,
8687 proxyOptions = argv [ 'proxy-options' ] ,
88+ websocket = argv . websocket ,
8789 utc = argv . U || argv . utc ,
8890 version = argv . v || argv . version ,
8991 baseDir = argv [ 'base-dir' ] ,
@@ -181,6 +183,14 @@ function listen(port) {
181183 }
182184 }
183185
186+ if ( websocket ) {
187+ if ( ! proxy ) {
188+ logger . warning ( colors . yellow ( 'WebSocket proxy will not be enabled because proxy is not enabled' ) ) ;
189+ } else {
190+ options . websocket = true ;
191+ }
192+ }
193+
184194 if ( argv . cors ) {
185195 options . cors = true ;
186196 if ( typeof argv . cors === 'string' ) {
0 commit comments