webpack-hot-middleware icon indicating copy to clipboard operation
webpack-hot-middleware copied to clipboard

webpack-hot-middleware run error under https

Open Pines-Cheng opened this issue 8 years ago • 8 comments

Our dev environment had upgraded from HTTP to https, but when I use the config of ?path=http//localhost:XXXX under the entry in webpack.config.js ,

webpack.config.js

'index': [
    'webpack-hot-middleware/client?path=http//localhost:' + siteConfig.port + '/__webpack_hmr',
    './js/index'
  ],

There are some mixed content error thrown :

Mixed Content: The page at 'https://corp.dinghuo123.com/index.html#/order/indent?_k=i76wt3' was loaded over HTTPS, but requested an insecure EventSource endpoint 'http://localhost:9898/__webpack_hmr'. This request has been blocked; the content must be served over HTTPS.

so ,I change the config of HTTP to https like this:

webpack.config.js

'index': [
    'webpack-hot-middleware/client?path=https//localhost:' + siteConfig.port + '/__webpack_hmr',
    './js/index'
  ],

But another error been thrown.

GET https://localhost:9898/__webpack_hmr net::ERR_CONNECTION_CLOSED

Can anyone have some prompt?

Pines-Cheng avatar Mar 23 '17 02:03 Pines-Cheng

I am running into the same problem. I would like to be able to use HTTPS for development but it is giving me the same error.

https://0.0.0.0/__webpack_hmr net::ERR_CONNECTION_REFUSED

andrewgbliss avatar Apr 26 '17 19:04 andrewgbliss

@andrewgbliss is the server running on port 443? If not you'll need the port number in there

glenjamin avatar Apr 26 '17 19:04 glenjamin

@glenjamin I have my node process running on 3000 and using nginx for a proxy running on port 80 for http and 443 for https. I have noticed though that if I put:

webpack-hot-middleware/client?noInfo=false&path=http://0.0.0.0:3000/__webpack_hmr

And I go straight to port 3000 it works a lot faster than going through nginx. But I am not sure how to get it working with https

andrewgbliss avatar Apr 26 '17 20:04 andrewgbliss

Ooooh, I just realised - 0.0.0.0 is invalid for a request address, it's only a valid value for listening addresses.

Use 127.0.0.1 or the hostname in the client config instead.

glenjamin avatar Apr 26 '17 20:04 glenjamin

@glenjamin It worked. Thank you. I changed it to:

webpack-hot-middleware/client?noInfo=false&path=http://127.0.0.1:3000/__webpack_hmr

And I was able to use https with it. I am not sure about the OP though. You shouldn't have to change it to https right?

andrewgbliss avatar Apr 26 '17 20:04 andrewgbliss

You shouldn't have to, but it should work with either.

glenjamin avatar Apr 26 '17 20:04 glenjamin

Hi, I.m also facing the same problem. I want my local to render in browser using https. I have updated my changes as discussed in the above, but still i'm facing the issue.But when i use webpack-dev-server if i add "webpack-dev-server -d --hot --https --port 443" my application is rendering in https.

Can anyone help how to work on webpack-hot-middleware using https.

saravanakumar2504 avatar Mar 28 '18 05:03 saravanakumar2504

Hello, same here, does anyone resolved it?

IzaGz avatar Jul 23 '18 07:07 IzaGz