1:修改配置文件config.js
proxy: {
// 默认配置:
'/api': {
target: 'http://10.147.17.129:8086',
ws: true,
changOrigin: true,
pathRewrite: {
'^/api': ''
}
},
// 第三方接口的配置
'/yushi-api': {
target: 'http://192.168.40.40:80',//这里是宇视的api地址
ws: true,
changOrigin: true,
pathRewrite: {
'^/yushi-api': ''
}
}
2:再<el-upload> 标签中添加 :with-credentials='true',修改上传地址为url: '/yushi-api/fastgate/fileUpload',
3:再获取到cookie的方法中添加cookie : document.cookie = ‘你的cookie';
4:调用第三方接口,会使用localhost:
5:nginx配置
#第三方服务转发
location /yushi-api/ {
proxy_pa