proxy

作者: Iterate | 来源:发表于2020-12-16 22:12 被阅读0次

https://github.com/staven630/vue-cli4-config#proxy

proxy: {
            '/api': {
              target: 'http://yd.msword.top', //API服务器的地址
              ws: true, //代理websockets
              changeOrigin: true, // 是否跨域,虚拟的站点需要更管origin
              pathRewrite: {
                // '^/api5'是一个正则表达式,表示要匹配请求的url中,全部'http://localhost:8081/api5' 转接为 http://localhost:8081/api/
                '^/api5': '/api',
                //重写路径 比如'/api/aaa/ccc'重写为'/aaa/ccc'
                '^/api': '',
              }
            },
            '/foo': {
                target: 'http://yd.abc.top'
            }
        },

相关文章

网友评论

      本文标题:proxy

      本文链接:https://www.haomeiwen.com/subject/vooogktx.html