proxyTable: {
"/api":{
target: 'https://app.hsltm.com',
changeOrigin: true,
pathRewrite: {
'^/api': '/api'
}
},
'/ssm-api': {
target: 'https://appdb.hsltm.com',
changeOrigin: true,
pathRewrite: {
'^/ssm-api': '/ssm-api'
}
},
'/wxapi-web': {
target: 'https://appdb.hsltm.com',
changeOrigin: true,
pathRewrite: {
'^/wxapi-web': '/wxapi-web'
}
}
},
上面是我配置的
--------------
Broadcast () {
let that = this
that.axios({
url: '/wxapi-web/...',
method: 'get',
}).then((response) => {
that.swiperLists = response.data.pageInfo.list
})
},
这是我的请求
-------------
到时候打包上线我还需要更改什么吗,到时候接口地址和web服务器不在一起
你现在写的
proxyTable
都是开发阶段的配置 打包都不会打这些东西补充:
你
url
用的绝对路径 你访问页面用的https://abc.com
那么 你对这个路径就是https://abc.com//wxapi-web/...
1 . web服务器 -> 接口服务器(设置跨域) 地址:
https://appdb.hsltm.com
你可以:
或者
2 . web服务器(设置代理功能) -> 接口服务器
你启动web服务器用的是什么 如果你的web服务器可以设置跨域 代码不用修改
3 . web服务器 -> 代理服务器 -> 接口服务器
代码同
1
一样url
要写成 代理服务器地址