Webpack-dev-server: v3.2.0 Breaks host parameter passed with options falling back to localhost

Created on 20 Feb 2019  路  11Comments  路  Source: webpack/webpack-dev-server

  • Operating System: macOS Mojave
  • Node Version: 10.15.1
  • NPM Version: 6.x
  • webpack Version: 4.x
  • webpack-dev-server Version: 3.2.0
  • [x] This is a bug
  • [ ] This is a modification request
...
devServer: {
   host: 'custom.local.host' // Gets disregarded
}

Most helpful comment

@evilebottnawi This resolves the issue for me https://github.com/webpack/webpack-dev-server/pull/1686. If you guys have better ideas up there, feel free to commit and let me know.

All 11 comments

@shobhitsharma Please describe you issue more verbosely, what do you mean Breaks host parameter?

Please create minimum reproducible test repo

  • Operating System: macOS Mojave
  • Node Version: 10.15.1
  • NPM Version: 6.x
  • webpack Version: 4.x
  • webpack-dev-server Version: 3.2.0

  • [x] This is a bug

  • [ ] This is a modification request

I am seeing the same issue, and have a project serving html with a local ssl certificate on:
https://app.domain.com:3000

The webpack assets are served on:
https://app.domain.com:8080

Using:

{
  devServer: {
    hot: true,
    inline: true,
    disableHostCheck: true,
    host: '0.0.0.0',
    headers: {
      'Access-Control-Allow-Origin': 'https://app.domain.com:3000'
    },
    https: {
      key: fs.readFileSync(path.join(__dirname, '../localssl/server.key')),
      cert: fs.readFileSync(path.join(__dirname, '../localssl/server.crt'))
    }
  }
}

Chrome now rejects assets from webpack due to ssl certificate host check.

@evilebottnawi This resolves the issue for me https://github.com/webpack/webpack-dev-server/pull/1686. If you guys have better ideas up there, feel free to commit and let me know.

v3.2.0 broke my --https setup with --host I get the autogenerated certificate instead of the one I pass in parameters

I don't understand the changes here: https://github.com/webpack/webpack-dev-server/commit/0b89fd9#diff-15fb51940da53816af13330d8ce69b4e cc @evilebottnawi

@shobhitsharma It's sad that such a change was merged and released! Hopefully your revert can be merged quickly!

Repro: https://github.com/phil-lgr/repro-https-issue

This in on Windows 10, Node LTS

node -v
v10.14.0

image

image

with "webpack-dev-server": "3.1.14":

image

it actually read the correct key

Looks like v3.2.0 just ignores --cert --key and the other --https args? let me know if you have any questions

@phil-lgr please don't post issue in difference issue, create new issue instead

@evilebottnawi Please write better testing in future to prevent issues like this.

@shobhitsharma it is open source and i am maintaining many projects and sometimes doesn't have enough time on all test cases, you can help us just send a PR with more tests

Was this page helpful?
0 / 5 - 0 ratings