proxy 代理地址

请求地址: `url: '/api/usermodule/user/verificationode',`

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

本文来自博客园,作者:云霄紫潭,转载请注明原文链接:https://www.cnblogs.com/0520euv/p/15512990.html

原文地址:https://www.cnblogs.com/0520euv/p/15512990.html