直入正题,直接在Vue-CLI的vue.config.js文件devServer字段配置:
// 证书的密码
pfxPassphrase: 'xxxx', // when develop with https need to provide server certificate to browser.
// 证书在本项目下的相对路径
pfx: './x/xx.pfx', // https://github.com/gitpod-io/gitpod/issues/26
// win10 host文件中 对本机IP映射的域名,例如本机IP 192.168.0.22, host文件对该IP的映射域名为 xxx.com
public: 'xxx.com' // https://stackoverflow.com/questions/43619644/i-am-getting-an-invalid-host-header-message-when-connecting-to-webpack-dev-ser