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

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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.185:31213', // 开发环境
  24. // target: 'http://172.20.32.98:8082',
  25. // target: 'http://172.20.32.150:8082',
  26. // 配置了这个可以从 http 代理到 https
  27. // 依赖 origin 的功能可能需要这个,比如 cookie
  28. changeOrigin: true,
  29. pathRewrite: { '^/api': '' },
  30. },
  31. '/profile/avatar/': {
  32. target: 'http://172.20.32.235:31213',
  33. changeOrigin: true,
  34. },
  35. },
  36. /**
  37. * @name 详细的代理配置
  38. * @doc https://github.com/chimurai/http-proxy-middleware
  39. */
  40. test: {
  41. // localhost:8000/api/** -> https://preview.pro.ant.design/api/**
  42. '/api/': {
  43. target: 'https://proapi.azurewebsites.net',
  44. changeOrigin: true,
  45. pathRewrite: { '^': '' },
  46. },
  47. },
  48. pre: {
  49. '/api/': {
  50. target: 'your pre url',
  51. changeOrigin: true,
  52. pathRewrite: { '^': '' },
  53. },
  54. },
  55. };