Skip to content

How to fix Invalid Host Header

Wang Tai edited this page Jun 19, 2022 · 2 revisions

ng (Angular)

Kill the server and restart it, adding --host 0.0.0.0 --disableHostCheck true to the command.

Angular2

Same as above, but add --host 0.0.0.0 --disable-host-check instead

webpack-dev-server

Kill the server and restart it, adding --host 0.0.0.0 to the command. --disable-host-check is sometimes needed here as well.

Vue

you need to change vue.config.js

v3:

module.exports = {
  devServer: {
    disableHostCheck: true,
  },
};

v4:

module.exports = {
  devServer: {
    allowedHosts: "all",
  },
};