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

31 lines
1.0 KiB

3 years ago
3 years ago
  1. spring:
  2. cloud:
  3. gateway:
  4. routes:
  5. - id: pms_route
  6. uri: lb://xujie-pms
  7. predicates:
  8. - Path=/api/pms/**
  9. filters:
  10. - RewritePath=/api/(?<segment>/?.*),/$\{segment}
  11. - id: qm_route
  12. uri: lb://xujie-qm
  13. predicates:
  14. - Path=/api/qm/**
  15. filters:
  16. - RewritePath=/api/(?<segment>/?.*),/$\{segment}
  17. - id: sys_route
  18. uri: lb://xujie-sys # lb 负载均衡到 xujie-sys服务
  19. predicates: # 断言
  20. - Path=/api/** # api开头的请求
  21. filters: #该RewritePath GatewayFilter工厂采用的路径regexp参数和replacement参数。这使用 Java 正则表达式来灵活地重写请求路径。以下清单配置了一个RewritePath GatewayFilter:
  22. - RewritePath=/api/(?<segment>/?.*),/$\{segment}
  23. nacos:
  24. discovery:
  25. server-addr: 192.168.1.83:8848
  26. ip: 127.0.0.1
  27. application:
  28. name: xujie-gateway
  29. server:
  30. port: 88