I am getting an “Invalid Host header” message when connecting to webpack-dev-server remotely

The problem occurs because webpack-dev-server 2.4.4 adds a host check. You can disable it by adding this to your webpack config:

 devServer: {
    compress: true,
    disableHostCheck: true,   // That solved it

 }      

Please note, this fix is insecure.

Please see this answer for a secure solution.

The option was refactored in version 4.0.0. The allowedHosts option should now be used:

devServer: {
  allowedHosts: "all"
}

Leave a Comment