proxy.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /**
  2. * 在生产环境 代理是无法生效的,所以这里没有生产环境的配置
  3. * -------------------------------
  4. * The agent cannot take effect in the production environment
  5. * so there is no configuration of the production environment
  6. * For details, please see
  7. * https://pro.ant.design/docs/deploy
  8. */
  9. export default {
  10. proxy: {
  11. '/api': {
  12. target: 'http://localhost:8081/',
  13. changeOrigin: true,
  14. pathRewrite: { '^/api': '' },
  15. },
  16. },
  17. dev: {
  18. // localhost:8000/api/** -> https://preview.pro.ant.design/api/**
  19. '/api': {
  20. // 要代理的地址
  21. target: 'http://localhost:8081/',
  22. // 配置了这个可以从 http 代理到 https
  23. // 依赖 origin 的功能可能需要这个,比如 cookie
  24. changeOrigin: true,
  25. pathRewrite: { '^/api': '' },
  26. },
  27. },
  28. test: {
  29. '/api/': {
  30. target: 'https://proapi.azurewebsites.net',
  31. changeOrigin: true,
  32. pathRewrite: { '^': '' },
  33. },
  34. },
  35. pre: {
  36. '/api/': {
  37. target: 'your pre url',
  38. changeOrigin: true,
  39. pathRewrite: { '^': '' },
  40. },
  41. },
  42. };