proxy.ts 993 B

123456789101112131415161718192021222324252627282930313233343536373839
  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 {
  13. dev: {
  14. '/api/': {
  15. target: 'https://localhost:8080',
  16. changeOrigin: true,
  17. pathRewrite: { '^': '' },
  18. },
  19. },
  20. /**
  21. * @name 详细的代理配置
  22. * @doc https://github.com/chimurai/http-proxy-middleware
  23. */
  24. test: {
  25. // localhost:8000/api/** -> https://preview.pro.ant.design/api/**
  26. '/api/': {
  27. target: 'https://proapi.azurewebsites.net',
  28. changeOrigin: true,
  29. pathRewrite: { '^': '' },
  30. },
  31. },
  32. pre: {
  33. '/api/': {
  34. target: 'your pre url',
  35. changeOrigin: true,
  36. pathRewrite: { '^': '' },
  37. },
  38. },
  39. };