首页 > 其他 > 详细

Vue cli4.0 代理配置

时间:2019-11-25 14:25:59      阅读:340      评论:0      收藏:0      [点我收藏+]
proxy: {
            ‘/service‘: {
                target: ‘http://192.168.40.243:3000/‘, //对应自己的接口
                changeOrigin: true,
                ws: true,
            },
            // ‘/page‘:{
            //     target: ‘http://192.168.0.167:9810‘,
            //     changeOrigin: true,
            //     ws:true
            // },
            // ‘/table‘:{
            //     target: ‘http://192.168.0.167:9810/‘,
            //     changeOrigin: true,
            //     ws:true
            // },
            ‘/api‘:{
                target: ‘http://192.168.0.167:9810‘,
                changeOrigin: true,
                pathRewrite: {
            ‘^/api‘:‘/api‘, // 这种接口配置出来实际请求接口 http://192.168.0.167:9810/api/login,
            ‘^/api‘: ‘/‘ } },// 这种接口配置出来实际请求接口 http://192.168.0.167:9810/login, (后端大爷接口没有同意前缀时可以这样处理,前端请求的时候自己加api 前缀,避免每一个不同的前缀要重写一遍)          
}

  

Vue cli4.0 代理配置

原文:https://www.cnblogs.com/winyh/p/11926893.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!