From 4dc7c865115d43205a83dc8a9c726f9ef00eaa53 Mon Sep 17 00:00:00 2001
From: Joe Haddad <timer150@gmail.com>
Date: Sun, 14 May 2017 22:04:05 -0400
Subject: [PATCH] Prefer localhost as an address (#2154)

---
 packages/react-scripts/scripts/start.js | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/packages/react-scripts/scripts/start.js b/packages/react-scripts/scripts/start.js
index fc226c169..0ea18e727 100644
--- a/packages/react-scripts/scripts/start.js
+++ b/packages/react-scripts/scripts/start.js
@@ -60,6 +60,19 @@ function run(port) {
     pathname: '/',
   });
 
+  let prettyHost;
+  if (HOST === '0.0.0.0' || HOST === '::') {
+    prettyHost = 'localhost';
+  } else {
+    prettyHost = HOST;
+  }
+  const prettyUrl = url.format({
+    protocol,
+    hostname: prettyHost,
+    port,
+    pathname: '/',
+  });
+
   // Create a webpack compiler that is configured with custom messages.
   const compiler = createWebpackCompiler(
     config,
@@ -100,7 +113,7 @@ function run(port) {
     console.log(chalk.cyan('Starting the development server...'));
     console.log();
 
-    openBrowser(formattedUrl);
+    openBrowser(prettyUrl);
   });
 }
 
-- 
GitLab