king
2021-04-07 f3167f8371d19d0ea8fe7d0e7af5517ff0b08cd2
src/setupProxy.js
@@ -1,61 +1,52 @@
const proxy = require('http-proxy-middleware')
const host = 'http://bms-test.kresstools.cn'
const service = 'oc/'
// const proxy = require('http-proxy-middleware')
// const host = 'http://qingqiumarket.cn'
// const service = 'mkwms/'
module.exports = function(app) {
  app.use(proxy('/webapi', {
    target: `${host}/${service}webapi`,
    secure: false,
    changeOrigin: true,
    pathRewrite: {
    '^/webapi': '/'
    }
    // cookieDomainRewrite: "http://localhost:3000"
  }))
module.exports = function() {}
// module.exports = function(app) {
//   app.use(proxy('/webapi', {
//     target: `${host}/${service}webapi`,
//     secure: false,
//     changeOrigin: true,
//     pathRewrite: {
//     '^/webapi': '/'
//     }
//     // cookieDomainRewrite: "http://localhost:3000"
//   }))
  
  app.use(proxy('/zh-CN', { // 登录接口
    target: `${host}/${service}zh-CN`,
    secure: false,
    changeOrigin: true,
    pathRewrite: {
    '^/zh-CN': '/'
    }
  }))
//   app.use(proxy('/zh-CN', { // 登录接口
//     target: `${host}/${service}zh-CN`,
//     secure: false,
//     changeOrigin: true,
//     pathRewrite: {
//     '^/zh-CN': '/'
//     }
//   }))
  app.use(proxy('/Upload', {
    target: `${host}/${service}zh-CN/Home/Upload`,
    secure: false,
    changeOrigin: true,
    pathRewrite: {
    '^/Upload': '/'
    }
  }))
//   app.use(proxy('/Upload', {
//     target: `${host}/${service}zh-CN/Home/Upload`,
//     secure: false,
//     changeOrigin: true,
//     pathRewrite: {
//     '^/Upload': '/'
//     }
//   }))
  app.use(proxy('/wxpay', {
    target: `${host}/${service}wxpay`,
    secure: false,
    changeOrigin: true,
    pathRewrite: {
    '^/wxpay': '/'
    }
  }))
//   app.use(proxy('/wxpay', {
//     target: `${host}/${service}wxpay`,
//     secure: false,
//     changeOrigin: true,
//     pathRewrite: {
//     '^/wxpay': '/'
//     }
//   }))
  app.use(proxy('/Home', {
    target: `${host}/Home`,
    secure: false,
    changeOrigin: true,
    pathRewrite: {
    '^/Home': '/'
    }
    // cookieDomainRewrite: "http://localhost:3000"
  }))
  app.use(proxy('/trans', {
    target: `${host}/${service}trans`,
    secure: false,
    changeOrigin: true,
    pathRewrite: {
    '^/trans': '/'
    }
  }))
}
//   app.use(proxy('/trans', {
//     target: `${host}/${service}trans`,
//     secure: false,
//     changeOrigin: true,
//     pathRewrite: {
//     '^/trans': '/'
//     }
//   }))
// }