proxy.ts 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /**
  2. * @name 代理的配置
  3. * @see 在生产环境 代理是无法生效的,所以这里没有生产环境的配置
  4. * -------------------------------
  5. * The agent cannot take effect in the production environment
  6. * so there is no configuration of the production environment
  7. * For details, please see
  8. * https://pro.ant.design/docs/deploy
  9. *
  10. * @doc https://umijs.org/docs/guides/proxy
  11. */
  12. export default function (envConfig: NodeJS.DevProcessEnv) {
  13. // 如果需要自定义本地开发服务器 请取消注释按需调整
  14. return {
  15. // localhost:8000/dev/** -> https://preview.pro.ant.design/api/**
  16. '/dev': {
  17. // 要代理的地址
  18. target: envConfig.REACT_APP_REAL_API_URL,
  19. // 配置了这个可以从 http 代理到 https
  20. // 依赖 origin 的功能可能需要这个,比如 cookie
  21. changeOrigin: true,
  22. pathRewrite: { '^/dev': '' },
  23. logLevel: 'debug',
  24. },
  25. '/d-res': {
  26. // 要代理的地址
  27. target: envConfig.REACT_APP_REAL_RES_SERVER,
  28. // 配置了这个可以从 http 代理到 https
  29. // 依赖 origin 的功能可能需要这个,比如 cookie
  30. changeOrigin: true,
  31. pathRewrite: { '^/d-res': '' },
  32. logLevel: 'debug',
  33. },
  34. '/d-stat': {
  35. // 要代理的地址
  36. target: envConfig.REACT_APP_STAT_REAL_API_URL,
  37. // 配置了这个可以从 http 代理到 https
  38. // 依赖 origin 的功能可能需要这个,比如 cookie
  39. changeOrigin: true,
  40. pathRewrite: { '^/d-stat': '' },
  41. logLevel: 'debug',
  42. },
  43. };
  44. }