我要请求的服务器A接口 为A
http://192.168.0.106:8080/qianbomall/app/login
服务器B的接口
http://pv.sohu.com/cityjson
现在我设置ProxyTable
proxyTable: [{
'/api': {
target: 'http://192.168.0.106:8080',
changeOrigin: true,
pathRewrite: {
'^/api': ''
}
}
},{
'/ips': {
target: 'http://pv.sohu.com',
changeOrigin: true,
pathRewrite: {
'^/ips': ''
}
}
}]
接口请求的时候,
axios.get('ips/cityjson')
axios.post('api/qianbomall/app/login')
请求直接把index.html给我返回了
如果 只设置一个代理的话是没有问题的,请问我是不是写法有问题
proxyTable: {
'/api': {
target: 'http://192.168.0.106:8080',
changeOrigin: true,
pathRewrite: {
'^/api': ''
}
}
}