Skip to content

Add support for setting the host in the executable #268

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 22, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion bin/node-http-proxy
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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;

//
Expand Down Expand Up @@ -77,7 +79,11 @@ else {
//
// Start the server
//
server.listen(port);
if (host) {
server.listen(port, host);
} else {
server.listen(port);
}

//
// Notify that the server is started
Expand Down