Webpack-dev-server: The `useLocalIp` option is not work as expected

Created on 14 Mar 2018  路  5Comments  路  Source: webpack/webpack-dev-server

  • Operating System: macOS
  • Node Version: 9.8.0
  • NPM Version: 5.7.1
  • webpack Version: 4.1.1
  • webpack-dev-server Version: 3.1.1

  • [x] This is a bug

  • [ ] This is a modification request

Expected Behavior

Can reach the site when use local IP.

Actual Behavior

Cannot reach the site when use local IP.

For Bugs; How can we reproduce the behavior?

  1. The local IP is 192.168.0.101 (example).
  2. Set the useLocalIp option: webpack-dev-server --mode development --hot --open --useLocalIp
  3. Open 192.168.0.101:8080 in browser
  4. Got error:
    This site can鈥檛 be reached 192.168.0.101 refused to connect.
  5. If I open 127.0.0.1:8080 or localhost:8080, it works fine.

Most helpful comment

Works with webpack-dev-server --mode development --host 0.0.0.0 --hot --open --useLocalIp

All 5 comments

Adding --host 0.0.0.0 fixed this for me.

192.168.0.101 is not local ip, use 0.0.0.0 as above if you want to attach dev server to all ip or use directly 192.168.0.101

Adding --host 0.0.0.0 could not fix this for me.

Works with webpack-dev-server --mode development --host 0.0.0.0 --hot --open --useLocalIp

Works with webpack-dev-server --mode development --host 0.0.0.0 --hot --open --useLocalIp

thank you so much!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gimmi picture gimmi  路  3Comments

daryn-k picture daryn-k  路  3Comments

MJ111 picture MJ111  路  3Comments

mischkl picture mischkl  路  3Comments

Ky6uk picture Ky6uk  路  3Comments