Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vue invalid host header

Don't know why 2 days ago my projects ( created via vue create ) stopped working - in Chrome i get

Invalid Host Header

and

WDS Disconnected

errors. In cmd everything compiles properly( npm run serve ) I don't know webpack, so i have no idea how to fix it.

What i've already done:

  • reinstalled node
  • deleted and reinstalled all npm packages
like image 521
user10826938 Avatar asked Dec 23 '18 20:12

user10826938


2 Answers

This issue is caused by this webpack-dev-server issue that has been fixed recently.

To avoid getting the Invalid Host/Origin header error add this to your devServer entry on vue.config.js file:

disableHostCheck: true

like image 88
iovanom Avatar answered Sep 28 '22 15:09

iovanom


Note that disableHostCheck: true is not recommended because it creates security vulnerabilities.

For a dev server running on my local machine, I could resolve the issue by explicitly setting --host in vue-cli-service serve:

scripts: {
  serve: "vue-cli-service serve --host myapp.localhost"
}

The --host option is documented here.

Visit the app in your browser under myapp.localhost:8080 (assuming you're using default port 8080).

like image 45
mori Avatar answered Sep 28 '22 17:09

mori