乐趣区

关于vue.js:vue跨域post

proxy: {
  '/api': {
    target: 'xxxxxxxxxxxxxxxx',
    ws: true,
    changeOrigin: true,
    pathRewrite: {'^/api': '/api'},
    cssSourceMap: false,
    onProxyReq: function (proxyReq, req, res) {if (proxyReq.getHeader('origin')) {proxyReq.setHeader('origin', 'xxxxxxxxxxxxxxxx')
      }

      console.log('原门路:' + req.originalUrl, '代理门路:' + req.path)
    }
  }

},
退出移动版