From 06e78f27475165d023fd66afbe5dd626a6a548af Mon Sep 17 00:00:00 2001 From: George Ornbo Date: Wed, 20 Jun 2012 15:51:31 +0100 Subject: [PATCH 1/2] adding support for setting the host --- bin/node-http-proxy | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/node-http-proxy b/bin/node-http-proxy index 87de8bb..0ffd127 100755 --- a/bin/node-http-proxy +++ b/bin/node-http-proxy @@ -13,6 +13,7 @@ var help = [ "", "options:", " --port PORT Port that the proxy server should run on", + " --host HOST Host that the proxy server should run on", " --target HOST:PORT Location of the server the proxy will target", " --config OUTFILE Location of the configuration file for the proxy server", " --silent Silence the log output from the proxy server", @@ -25,6 +26,7 @@ if (argv.h || argv.help || Object.keys(argv).length === 2) { var location, config = {}, port = argv.port || 80, + host = argv.host || undefined, target = argv.target; // @@ -77,7 +79,11 @@ else { // // Start the server // -server.listen(port); +if (!host) { + server.listen(port); +} else { + server.listen(port, host); +} // // Notify that the server is started From 415d4ed908e45332421d683eb45e0d6873b85ae7 Mon Sep 17 00:00:00 2001 From: George Ornbo Date: Wed, 20 Jun 2012 20:59:17 +0100 Subject: [PATCH 2/2] match style requested by @cronopio --- bin/node-http-proxy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/node-http-proxy b/bin/node-http-proxy index 0ffd127..b15d164 100755 --- a/bin/node-http-proxy +++ b/bin/node-http-proxy @@ -79,10 +79,10 @@ else { // // Start the server // -if (!host) { - server.listen(port); -} else { +if (host) { server.listen(port, host); +} else { + server.listen(port); } //