Skip to content

Commit 06e78f2

Browse files
committed
adding support for setting the host
1 parent ccd8f84 commit 06e78f2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

bin/node-http-proxy

+7-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ var help = [
1313
"",
1414
"options:",
1515
" --port PORT Port that the proxy server should run on",
16+
" --host HOST Host that the proxy server should run on",
1617
" --target HOST:PORT Location of the server the proxy will target",
1718
" --config OUTFILE Location of the configuration file for the proxy server",
1819
" --silent Silence the log output from the proxy server",
@@ -25,6 +26,7 @@ if (argv.h || argv.help || Object.keys(argv).length === 2) {
2526

2627
var location, config = {},
2728
port = argv.port || 80,
29+
host = argv.host || undefined,
2830
target = argv.target;
2931

3032
//
@@ -77,7 +79,11 @@ else {
7779
//
7880
// Start the server
7981
//
80-
server.listen(port);
82+
if (!host) {
83+
server.listen(port);
84+
} else {
85+
server.listen(port, host);
86+
}
8187

8288
//
8389
// Notify that the server is started

0 commit comments

Comments
 (0)