Invalid Host header


My server.js file is following, when click the preview, I got the error message: Invalid Host header

var webpack = require("webpack");
var WebpackDevServer = require("webpack-dev-server");
var config = require("./webpack.config.js");"webpack-dev-server/client?http://localhost:3000/");
var compiler = webpack(config);
var server = new WebpackDevServer(compiler);
server.listen(3000, "localhost");


It’d be helpful if you can provide the project name so I can take a proper look, but I’m assuming it’s not liking the localhost - try


Hi @Gareth, thank you. Here is my project:!/test-glitch

I also tried the, the result is the same.


I fixed the issue by modify the following line:

var server = new WebpackDevServer(compiler, {
  disableHostCheck: true


hah, yes - I was just looking at and it mentions that or specifically using 2.4.2, which worked too.


Yes, my solution is also come from there.