环境:vueCli4+vue2.x+vuerouter
新建vue.config.js文件添加以下配置
module.exports = {
devServer: {
proxy: {
'/api': {
// target: 'http://127.0.0.0:8080',
target: 'https://aip.baidubce.com',
changeOrigin: true,
pathRewrite: {
'^/api': ''
}
}
}
}
}