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