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 2.3 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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://36.103.199.74:31213', // 公网环境
  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. '/proxyApi/skybox-flames/': {
  37. target: 'http://36.103.199.74:30009/',
  38. // target: 'http://172.31.164.103:30009/',
  39. changeOrigin: true,
  40. rewrite: (path) => path.replace(/^\/proxyApi\/skybox-flames/, ''),
  41. },
  42. '/proxyApi/skybox-flames/flames/api/v1': {
  43. target: 'http://36.103.199.74:30009/',
  44. // target: 'http://172.31.164.103:30009/',
  45. changeOrigin: true,
  46. rewrite: (path) =>
  47. path.replace(
  48. /^\/proxyApi\/skybox-flames\/flames\/api\/v1/,
  49. '/flames/api/v1'
  50. ),
  51. },
  52. '/proxyApi/': {
  53. target: 'http://36.103.199.74:30009/',
  54. // target: 'http://172.31.164.103:30009/',
  55. },
  56. },
  57. /**
  58. * @name 详细的代理配置
  59. * @doc https://github.com/chimurai/http-proxy-middleware
  60. */
  61. test: {
  62. // localhost:8000/api/** -> https://preview.pro.ant.design/api/**
  63. '/api/': {
  64. target: 'https://proapi.azurewebsites.net',
  65. changeOrigin: true,
  66. pathRewrite: { '^': '' },
  67. },
  68. },
  69. pre: {
  70. '/api/': {
  71. target: 'your pre url',
  72. changeOrigin: true,
  73. pathRewrite: { '^': '' },
  74. },
  75. },
  76. };