proxy.js 936 Bytes
Newer Older
1
const proxyURL = process.env.PANDA_ENV_PROXY || 'http://192.168.8.28:8911';
喻天's avatar
喻天 committed
2 3 4 5 6 7 8
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
9 10
export default {
  '/api': {
11
    target: proxyURL,
崔佳豪's avatar
崔佳豪 committed
12 13 14
    changeOrigin: true,
    pathRewrite: { '^/api': '' },
  },
喻天's avatar
喻天 committed
15 16 17 18 19 20 21 22
  '/jessica': {
    target: wsServerPath,
    changeOrigin: true,
    ws: true,
    pathRewrite: {
      '/jessica': '/jessica',
    },
  },
崔佳豪's avatar
崔佳豪 committed
23 24 25 26 27 28 29 30 31 32
  '/PandaMonitor': {
    target: proxyURL,
    changeOrigin: true,
    headers: {
      'Access-Control-Allow-Origin': '*',
    },
    pathRewrite: {
      '/PandaMonitor': '/PandaMonitor',
    },
  },
33 34 35 36 37 38 39 40 41 42
  '/PandaCore': {
    target: proxyURL,
    changeOrigin: true,
    headers: {
      'Access-Control-Allow-Origin': '*',
    },
    pathRewrite: {
      '/PandaCore': '/PandaCore',
    },
  },
崔佳豪's avatar
崔佳豪 committed
43
};