美文网首页Spring Cloud微服务
Spring Cloud Gateway配置文件配置讲解

Spring Cloud Gateway配置文件配置讲解

作者: King斌 | 来源:发表于2020-06-24 17:24 被阅读0次
    spring:
      application:
        name: gateway-service
      cloud:
        gateway:
          routes:
            - id: data-service1  #请求 http://localhost:8100/data-service1/test会转发到data-producer服务
              uri: lb://data-producer  #在服务注册中心找服务名为 data-producer的服务
              predicates:
                - Path=/data-service1/*  #设置路由断言,代理servicerId为data-service1的/ data-service1 /路径
              filters:
                - StripPrefix=1
            - id: data-service2  # 请求 http://localhost:8100/data-service2/test转发到 http://localhost:8080/test
              uri: http://localhost:8080
              predicates:
                - Path=/data-service2/*
              filters:
                - StripPrefix=1  #前缀, 在当前路径匹配中表示去掉第一个前缀 /data-service2
    

    相关文章

      网友评论

        本文标题:Spring Cloud Gateway配置文件配置讲解

        本文链接:https://www.haomeiwen.com/subject/fdfdfktx.html