Vue CLI and custom local domain

Posted on August 30, 2019

I have a local dev setup with browser-sync and other toolchain that I want to replace with the Vue CLI.

For technical reasons, I need to use a custom local domain during development, configured in the hosts file of my system, such as http://myapp.mypersonaldevdomain.com.

So, here the surprice running npm run serve from a Vue app, trying to point that domain in the browser:

Invalid Host header

The solution is quite straightforward, configuring an option in the webpack config, as outlined in this comment:

devServer: {
  disableHostCheck: true
}

That fixed the issue giving me the possibility to run my app throught my local domain.

Not really sure the reason why of this check, though.