其他分享
首页 > 其他分享> > spring-cloud-gateway 转发

spring-cloud-gateway 转发

作者:互联网

 

spring:
  application:
    name: geteway
  cloud:
    gateway:
      routes:
      - id: baidu_route
        uri: http://www.baidu.com  # 目标服务地址
        predicates:
        - Path=/baidu

      # 路径匹配
      - id: account_info
        uri: http://localhost:9000/account/info  # 目标服务地址
        predicates:
        - Path=/account/info

      # 路径通配匹配
#      - id: 100_forward
#        uri: http://localhost:9000/*  # 目标服务地址
#        predicates:
#          - Path=/100/*

        # 路径通配匹配
      - id: 101_forward
#        uri: http://localhost:9001/101/*  # 目标服务地址
        uri: http://localhost:9001  # 目标服务地址
        predicates:
          - Path=/101/*

      # lb 负载均衡
      - id: account_info
        uri: lb://user-service
        predicates:
          - Path=/user-service/**

      # lb 负载均衡 去掉路径
      - id: 100_lb_forward
        uri: lb://user-service  # 目标服务地址
        predicates:
          - Path=/100/*

 

 

 

 

 

 

 

 

 

 

 

 

 

标签:lb,http,spring,uri,gateway,predicates,Path,id,cloud
来源: https://blog.csdn.net/kq1983/article/details/115797865