Skip to content

Commit

Permalink
Start the dev server at the specified host
Browse files Browse the repository at this point in the history
Pass the host from environment variable as argument of the devServer's
listen function instead of a field of options object.
Set the default host to 0.0.0.0 instead of localhost.
  • Loading branch information
GAumala committed Dec 21, 2016
1 parent 7d66ba1 commit 4332d38
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/react-scripts/scripts/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,15 +267,14 @@ function runDevServer(host, port, protocol) {
ignored: /node_modules/
},
// Enable HTTPS if the HTTPS environment variable is set to 'true'
https: protocol === "https",
host: host
https: protocol === "https"
});

// Our custom middleware proxies requests to /index.html or a remote API.
addMiddleware(devServer);

// Launch WebpackDevServer.
devServer.listen(port, (err, result) => {
devServer.listen(port, host, (err, result) => {
if (err) {
return console.log(err);
}
Expand All @@ -292,7 +291,7 @@ function runDevServer(host, port, protocol) {

function run(port) {
var protocol = process.env.HTTPS === 'true' ? "https" : "http";
var host = process.env.HOST || 'localhost';
var host = process.env.HOST || '0.0.0.0';
setupCompiler(host, port, protocol);
runDevServer(host, port, protocol);
}
Expand Down

0 comments on commit 4332d38

Please sign in to comment.