From c4b92837fa519cc8845df380e11f4378242eebea Mon Sep 17 00:00:00 2001 From: Arun Kumar Date: Thu, 8 Nov 2018 18:59:17 +0530 Subject: [PATCH] fix: use relative HMR path (#9734) Construct webpack hmr path relative to the request origin path to prevent url construction issues when accessing from local ip or any other ip that may be mapped to the dev server. This PR makes following changes to `getHmrPath()` method in `packages/gatsby/src/utils/webpack.config.js` - Always use the relative path `/` - Getting rid of manual url construction with protocol, hosts, ports etc as the relative path will automatically take care of this construction --- packages/gatsby/src/utils/webpack.config.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/gatsby/src/utils/webpack.config.js b/packages/gatsby/src/utils/webpack.config.js index 6aa29a3771d13..eee70b89c9aef 100644 --- a/packages/gatsby/src/utils/webpack.config.js +++ b/packages/gatsby/src/utils/webpack.config.js @@ -71,10 +71,8 @@ module.exports = async ( } function getHmrPath() { - let hmrBasePath = `${program.ssl ? `https` : `http`}://${ - program.host - }:${webpackPort}/` - + // ref: https://github.com/gatsbyjs/gatsby/issues/8348 + let hmrBasePath = `/` const hmrSuffix = `__webpack_hmr&reload=true&overlay=false` if (process.env.GATSBY_WEBPACK_PUBLICPATH) {