webpack dev server配置反向代理的时候总是报错404,请问怎么解决?
错误日志:GET http://localhost:8080/mzabris... 404 (Not Found)
配置文件:
devServer: {
inline: true,
noInfo: true,
port: 8080,
proxy: {
'/mzabriskie': {
target: 'https://github.com',
changeOrigin: true
}
}
},
接口代码:
this.$http.get('/mzabriskie/axios').then((response) => {
console.log(response)
}).catch((error) => {
console.log(error)
})
滿天的星座2017-05-18 11:03:53
加一行
proxy: {
'/mzabriskie': {
target: 'https://github.com',
changeOrigin: true,
'/mzabriskie': '/mzabriskie'
}
}
然后重启webpack