Skip to content
This repository was archived by the owner on Sep 6, 2019. It is now read-only.

Commit 4ed9843

Browse files
author
matthieu faugere
committed
1 parent a98c3df commit 4ed9843

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

packages/react-dev-utils/webpackHotDevClient.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ if (module.hot && typeof module.hot.dispose === 'function') {
6161
var connection = new SockJS(
6262
url.format({
6363
protocol: window.location.protocol,
64-
hostname: window.location.hostname,
65-
port: window.location.port,
64+
hostname: process.env.HOST || window.location.hostname,
65+
port: process.env.PORT || window.location.port,
6666
// Hardcoded in WebpackDevServer
67-
pathname: '/sockjs-node',
67+
pathname: '/sockjs-node'
6868
})
6969
);
7070

packages/react-scripts/config/env.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ function getClientEnvironment(publicUrl) {
8585
// This should only be used as an escape hatch. Normally you would put
8686
// images into the `src` and `import` them in code to get their paths.
8787
PUBLIC_URL: publicUrl,
88+
89+
// Useful for allowing the hot dev websocket to connect to the host
90+
// specified in the env file, instead of window.location, which could
91+
// be wrong if the dev server is being proxied.
92+
HOST: process.env.HOST || '',
93+
PORT: process.env.PORT || ''
8894
}
8995
);
9096
// Stringify all values so we can feed into Webpack DefinePlugin

0 commit comments

Comments
 (0)