king
2022-05-09 28ebe609e47b28794450cefc72d3e0f62fd904e7
src/setupProxy.js
@@ -1,32 +1,55 @@
const proxy = require('http-proxy-middleware')
const service = 'mkwms'
const host = 'http://qingqiumarket.cn'
const service = 'mkwms/'
// module.exports = function(app) {}
module.exports = function(app) {
  app.use(proxy('/webapi', {
    target: `http://qingqiumarket.cn/${service}/webapi`,
    secure: false,
    changeOrigin: true,
    pathRewrite: {
    '^/webapi': '/'
    }
    // cookieDomainRewrite: "http://localhost:3000"
  }))
  // app.use(proxy('/webapi', {
  //   target: `${host}/${service}webapi`,
  //   secure: false,
  //   changeOrigin: true,
  //   pathRewrite: {
  //   '^/webapi': '/'
  //   }
  //   // cookieDomainRewrite: "http://localhost:3000"
  // }))
  
  app.use(proxy('/zh-CN', { // 登录接口
    target: `http://qingqiumarket.cn/${service}/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('/wxpay', {
  //   target: `${host}/${service}wxpay`,
  //   secure: false,
  //   changeOrigin: true,
  //   pathRewrite: {
  //   '^/wxpay': '/'
  //   }
  // }))
  app.use(proxy('/trans', {
    target: `${host}/${service}`,
    secure: false,
    changeOrigin: true,
    pathRewrite: {
    '^/zh-CN': '/'
    }
    changeOrigin: true
  }))
  app.use(proxy('/local', {
    target: 'http://127.0.0.1:8888',
  app.use(proxy('/api', { // 旷视面板机接口测试
    target: `http://192.168.1.66:80`,
    secure: false,
    changeOrigin: true,
    pathRewrite: {
    '^/local': '/'
    }
    changeOrigin: true
  }))
}