配置

配置内容

spring.cloud.gateway.routes[0].id=system
spring.cloud.gateway.routes[0].uri=http://127.0.0.1:9001
spring.cloud.gateway.routes[0].predicates[0].name=Path
spring.cloud.gateway.routes[0].predicates[0].args[0]=/system/**

详解

1、spring.cloud.gateway.routes[0].id=system
要转发到的哪个模块
2、spring.cloud.gateway.routes[0].uri=http://127.0.0.1:9001
转发到的模块的地址
3、spring.cloud.gateway.routes[0].predicates[0].name=Path
我们这个路由是基于一个配置的,这个配置是以下4中的内容
4、spring.cloud.gateway.routes[0].predicates[0].args[0]=/system/**
只要是路径带有 ‘/’ 的,我们都转发到2中的路径去

配置位置

application.properties文件

spring Colud路由转发 (gateway)

一个路由配置

spring Colud路由转发 (gateway)

多个路由配置

以下案例是两个路由时的情况配置,依次类推,只需要把数字改了就可以了
spring Colud路由转发 (gateway)

相关文章:

  • 2021-05-23
  • 2021-08-06
  • 2021-11-10
  • 2022-12-23
  • 2022-12-23
  • 2021-09-12
  • 2022-12-23
猜你喜欢
  • 2021-12-16
  • 2021-10-24
  • 2021-07-30
  • 2021-09-11
  • 2021-11-18
  • 2022-12-23
相关资源
相似解决方案