proxy.js 1.37 KB
Newer Older
1 2 3 4 5
/*
 * @Title: 
 * @Author: hongmye
 * @Date: 2023-09-28 17:01:39
 */
6
const proxyURL = process.env.PANDA_ENV_PROXY || 'http://192.168.8.28:8911';
喻天's avatar
喻天 committed
7 8 9 10 11 12 13
let exUrl = '';
if (proxyURL.includes(proxyURL.toLowerCase().includes('https'))) {
  exUrl = proxyURL.replace('https', 'ws');
} else {
  exUrl = proxyURL.replace('http', 'ws');
}
const wsServerPath = exUrl;
崔佳豪's avatar
崔佳豪 committed
14 15
export default {
  '/api': {
16
    target: proxyURL,
崔佳豪's avatar
崔佳豪 committed
17 18 19
    changeOrigin: true,
    pathRewrite: { '^/api': '' },
  },
喻天's avatar
喻天 committed
20 21 22 23 24 25 26 27
  '/jessica': {
    target: wsServerPath,
    changeOrigin: true,
    ws: true,
    pathRewrite: {
      '/jessica': '/jessica',
    },
  },
崔佳豪's avatar
崔佳豪 committed
28 29 30 31 32 33 34 35 36 37
  '/PandaMonitor': {
    target: proxyURL,
    changeOrigin: true,
    headers: {
      'Access-Control-Allow-Origin': '*',
    },
    pathRewrite: {
      '/PandaMonitor': '/PandaMonitor',
    },
  },
38 39 40 41 42 43 44 45 46 47
  '/PandaCore': {
    target: proxyURL,
    changeOrigin: true,
    headers: {
      'Access-Control-Allow-Origin': '*',
    },
    pathRewrite: {
      '/PandaCore': '/PandaCore',
    },
  },
陈龙's avatar
陈龙 committed
48 49 50 51 52 53 54 55 56 57
  '/PandaWater': {
    target: proxyURL,
    changeOrigin: true,
    headers: {
      'Access-Control-Allow-Origin': '*',
    },
    pathRewrite: {
      '/PandaWater': '/PandaWater',
    },
  },
58 59 60 61 62 63 64 65 66 67
  '/PandaWorkFlow': {
    target: proxyURL,
    changeOrigin: true,
    headers: {
      'Access-Control-Allow-Origin': '*',
    },
    pathRewrite: {
      '/PandaWorkFlow': '/PandaWorkFlow',
    },
  },
崔佳豪's avatar
崔佳豪 committed
68
};