ruoyi-gateway.yml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. # 安全配置
  2. security:
  3. # 不校验白名单
  4. ignore:
  5. whites:
  6. - /auth/code
  7. - /auth/logout
  8. - /auth/login
  9. - /auth/binding/*
  10. - /auth/register
  11. - /auth/tenant/list
  12. - /resource/sms/code
  13. - /resource/sse/close
  14. - /*/v3/api-docs
  15. - /*/error
  16. - /csrf
  17. - /warm-flow-ui/**
  18. spring:
  19. cloud:
  20. # 网关配置
  21. gateway:
  22. # 打印请求日志(自定义)
  23. requestLog: true
  24. discovery:
  25. locator:
  26. lowerCaseServiceId: true
  27. enabled: true
  28. routes:
  29. # ================== 中车 (Zhongche) 域名专属路由 ==================
  30. # 1. 中车 - 登录接口特殊处理
  31. - id: zhongche-auth-login
  32. uri: lb://ruoyi-auth
  33. predicates:
  34. - Host=zhongche.yoe365.com
  35. # 前端实际请求路径
  36. - Path=/api/mall/auth/login
  37. filters:
  38. # 将 /api/mall/auth/login 重写为 /zhongche/access_token(直接匹配 Controller 路径)
  39. - RewritePath=/api/mall/auth/login, /zhongche/access_token
  40. # 2. 中车 - 其他通用 mall 接口
  41. - id: zhongche-mall-api
  42. uri: lb://ruoyi-external
  43. predicates:
  44. - Host=zhongche.yoe365.com
  45. - Path=/api/mall/**
  46. filters:
  47. # 将 /api/mall/xxx 重写为 /zhongche/api/mall/xxx
  48. - RewritePath=/api/mall/(?<segment>.*), /zhongche/api/mall/${segment}
  49. # ================== 同济 (Tongji) 域名专属路由 ==================
  50. # 3. 同济 - 登录接口特殊处理
  51. - id: tongji-auth-login
  52. uri: lb://ruoyi-auth
  53. predicates:
  54. - Host=jingyang.xiaoluwebsite.xyz
  55. # 前端实际请求路径
  56. - Path=/api/mall/auth/login
  57. filters:
  58. # 将 /api/mall/auth/login 重写为 /tongji/access_token(直接匹配 Controller 路径)
  59. - RewritePath=/api/mall/auth/login, /tongji/access_token
  60. # 4. 同济 - 其他通用 mall 接口
  61. - id: tongji-mall-api
  62. uri: lb://ruoyi-external
  63. predicates:
  64. - Host=jingyang.xiaoluwebsite.xyz
  65. - Path=/api/mall/**
  66. filters:
  67. # 将 /api/mall/xxx 重写为 /tongji/api/mall/xxx
  68. - RewritePath=/api/mall/(?<segment>.*), /tongji/api/mall/${segment}
  69. # ================== 默认路由(放在最后,优先级最低) ==================
  70. # 认证中心
  71. - id: ruoyi-auth
  72. uri: lb://ruoyi-auth
  73. predicates:
  74. - Path=/auth/**
  75. filters:
  76. - StripPrefix=1
  77. # 代码生成
  78. - id: ruoyi-gen
  79. uri: lb://ruoyi-gen
  80. predicates:
  81. - Path=/tool/**
  82. filters:
  83. - StripPrefix=1
  84. # 系统模块
  85. - id: ruoyi-system
  86. uri: lb://ruoyi-system
  87. predicates:
  88. - Path=/system/**,/monitor/**
  89. filters:
  90. - StripPrefix=1
  91. # 资源服务
  92. - id: ruoyi-resource
  93. uri: lb://ruoyi-resource
  94. predicates:
  95. - Path=/resource/**
  96. filters:
  97. - StripPrefix=1
  98. # workflow服务
  99. - id: ruoyi-workflow
  100. uri: lb://ruoyi-workflow
  101. predicates:
  102. - Path=/workflow/**
  103. filters:
  104. - StripPrefix=1
  105. # warm-flow服务
  106. - id: warm-flow
  107. uri: lb://ruoyi-workflow
  108. predicates:
  109. - Path=/warm-flow-ui/**,/warm-flow/**
  110. # 演示服务
  111. - id: ruoyi-demo
  112. uri: lb://ruoyi-demo
  113. predicates:
  114. - Path=/demo/**
  115. filters:
  116. - StripPrefix=1
  117. # MQ演示服务
  118. - id: ruoyi-test-mq
  119. uri: lb://ruoyi-test-mq
  120. predicates:
  121. - Path=/test-mq/**
  122. filters:
  123. - StripPrefix=1
  124. # sentinel 配置
  125. sentinel:
  126. filter:
  127. enabled: false
  128. # nacos配置持久化
  129. datasource:
  130. ds1:
  131. nacos:
  132. server-addr: ${spring.cloud.nacos.server-addr}
  133. dataId: sentinel-${spring.application.name}.json
  134. groupId: ${spring.cloud.nacos.config.group}
  135. username: ${spring.cloud.nacos.username}
  136. password: ${spring.cloud.nacos.password}
  137. namespace: ${spring.profiles.active}
  138. data-type: json
  139. rule-type: gw-flow