You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.2 KiB

2 months ago
  1. /**
  2. * Generate proxy
  3. * @param list
  4. */
  5. export function createProxy() {
  6. return {
  7. // 字符串简写写法
  8. // '/foo': 'http://localhost:4567',
  9. // 选项写法
  10. // '/api': {
  11. // target: process .env.VITE_APP_API_BASE_URL || 'http://192.168.8.93:3001',
  12. // changeOrigin: true,
  13. // rewrite: (path) => path.replace(/^\/api/, '')
  14. // },
  15. // // 全球指数
  16. // '/hcm': {
  17. // target: process.env.VITE_APP_API_BASE_URL_HCM || 'http://192.168.8.93:3001',
  18. // changeOrigin: true,
  19. // rewrite: (path) => path.replace(/^\/hcm/, '')
  20. // },
  21. // // 时空预测
  22. // '/pre': {
  23. // target: process.env.VITE_APP_API_BASE_URL_AI || 'http://192.168.8.93:3001',
  24. // changeOrigin: true,
  25. // rewrite: (path) => path.replace(/^\/pre/, '')
  26. // }
  27. // 正则表达式写法
  28. // '^/fallback/.*': {
  29. // target: 'http://jsonplaceholder.typicode.com',
  30. // changeOrigin: true,
  31. // rewrite: (path) => path.replace(/^\/fallback/, '')
  32. // }
  33. // 使用 proxy 实例
  34. // "/api": {
  35. // target: "http://jsonplaceholder.typicode.com",
  36. // changeOrigin: true,
  37. // configure: (proxy, options) => {
  38. // // proxy 是 'http-proxy' 的实例
  39. // },
  40. // },
  41. }
  42. }