Ethan Zhu
©️朱俊辉
All Rights Reserved.

vue-cli 解决Invalid Host header

项目中测试服务器需要域名映射,映射成功了,出现Invalid Host header的问题

解决方案

在webpack.dev.conf.js中添加:disableHostCheck: true

devServer: {
public: ‘local.kingsum.biz’,
clientLogLevel: ‘warning’,
historyApiFallback: true,
hot: true,
compress: true,
host: HOST || config.dev.host,
port: PORT || config.dev.port,

open: config.dev.autoOpenBrowser,
overlay: config.dev.errorOverlay
? { warnings: false, errors: true }
: false,
publicPath: config.dev.assetsPublicPath,
proxy: config.dev.proxyTable,
quiet: true, // necessary for FriendlyErrorsPlugin

watchOptions: {
poll: config.dev.poll,
},
disableHostCheck: true 加上这段
}

2018-05-31

发表评论