From d4f6e447d2019ba784a83149a22bc6f392accee5 Mon Sep 17 00:00:00 2001 From: DengYun Date: Tue, 19 Jan 2016 16:47:01 -0800 Subject: [PATCH] add host argument for packager. Summary: Now packager only listen to "::", which is IPv6 "Any address". It failed to run in IPv4 Environment. defaults to undefined or empty string will fix this. And I think it's necessary to let user define host by cli argument. It's also for security reason. When working on a public network, it's much safer to listen with localhost instead of ::, which may let everyone in same network be able to get your code from debugger-ui. recommit for #1918, fixes #2441 Closes https://github.com/facebook/react-native/pull/5377 Reviewed By: svcscm Differential Revision: D2842594 Pulled By: martinbigio fb-gh-sync-id: 575944c5469dac80e99136a7903ea99f5339dba1 --- local-cli/server/runServer.js | 2 +- local-cli/server/server.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/local-cli/server/runServer.js b/local-cli/server/runServer.js index c3a39a15a..7d7463a06 100644 --- a/local-cli/server/runServer.js +++ b/local-cli/server/runServer.js @@ -44,7 +44,7 @@ function runServer(args, config, readyCallback) { const serverInstance = http.createServer(app).listen( args.port, - '::', + args.host, function() { attachHMRServer({ httpServer: serverInstance, diff --git a/local-cli/server/server.js b/local-cli/server/server.js index 3abffb5be..21d1d8e2c 100644 --- a/local-cli/server/server.js +++ b/local-cli/server/server.js @@ -30,6 +30,10 @@ function _server(argv, config, resolve, reject) { command: 'port', default: 8081, type: 'string', + }, { + command: 'host', + default: '', + type: 'string', }, { command: 'root', type: 'string',