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

proxy.ts 1.6 kB

2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * @Author: 赵伟
  3. * @Date: 2024-04-17 08:48:09
  4. * @Description:
  5. */
  6. /**
  7. * @name 代理的配置
  8. * @see 在生产环境 代理是无法生效的,所以这里没有生产环境的配置
  9. * -------------------------------
  10. * The agent cannot take effect in the production environment
  11. * so there is no configuration of the production environment
  12. * For details, please see
  13. * https://pro.ant.design/docs/deploy
  14. *
  15. * @doc https://umijs.org/docs/guides/proxy
  16. */
  17. export default {
  18. // 如果需要自定义本地开发服务器 请取消注释按需调整
  19. dev: {
  20. // localhost:8000/api/** -> https://preview.pro.ant.design/api/**
  21. '/api/': {
  22. // 要代理的地址
  23. target: 'http://172.20.32.197:31213', // 开发环境
  24. // target: 'http://172.20.32.235:31213', // 测试环境
  25. // target: 'http://172.20.32.44:8082',
  26. // target: 'http://172.20.32.164:8082',
  27. // 配置了这个可以从 http 代理到 https
  28. // 依赖 origin 的功能可能需要这个,比如 cookie
  29. changeOrigin: true,
  30. // pathRewrite: { '^/api': '' },
  31. },
  32. '/profile/avatar/': {
  33. target: 'http://172.20.32.235:31213',
  34. changeOrigin: true,
  35. },
  36. },
  37. /**
  38. * @name 详细的代理配置
  39. * @doc https://github.com/chimurai/http-proxy-middleware
  40. */
  41. test: {
  42. // localhost:8000/api/** -> https://preview.pro.ant.design/api/**
  43. '/api/': {
  44. target: 'https://proapi.azurewebsites.net',
  45. changeOrigin: true,
  46. pathRewrite: { '^': '' },
  47. },
  48. },
  49. pre: {
  50. '/api/': {
  51. target: 'your pre url',
  52. changeOrigin: true,
  53. pathRewrite: { '^': '' },
  54. },
  55. },
  56. };