Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修改了 hosts 文件以后用域名代替 ip 访问本地项目出现「Invalid Host header」 #172

Open
lovelmh13 opened this issue Oct 5, 2021 · 0 comments

Comments

@lovelmh13
Copy link
Owner

用 vue-cli 创建了项目,然后改了 hosts 文件,用域名访问本地的项目,显示「Invalid Host header」。

原来是 webpack 配置的原因。

只需要在 webpack 配置文件中增加:

module.exports = {
  devServer: {
    disableHostCheck: true // 防止 Invalid Host header
  }
}

就可以了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant