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/*

 

 

 

 

 

 

 

 

 

 

 

 

 

上一篇:Is Query Optimization a “Solved” Problem? (2014, Guy Lohman)


下一篇:Spring Cloud Gateway实战之五:内置filter