SpringCloud之Gateway组件的简单配置

user-management-host: http://localhost:8080/EF_ServicePlatfrom/
spring:
  cloud:
    gateway:
      routes:
        - id: blog
          method: POST
          uri: ${user-management-host}rppsignin.html
          predicates:
            # 匹配路径转发
            - Path=/EF_ServicePlatfrom/rppsignin.html
        - id: online
          method: POST
          uri: ${user-management-host}rppDebugging.html
          predicates:
            # 匹配路径转发
            - Path=/EF_ServicePlatfrom/rppDebugging.html
        - id: quit
          method: POST
          uri: ${user-management-host}session/rppKickout.html
          predicates:
            # 匹配路径转发
            - Path=/EF_ServicePlatfrom/session/rppKickout.html
      # 采用自定义路由 ID(有固定用法,不同的 id 有不同的功能,详见:https://cloud.spring.io/spring-cloud-gateway/2.0.x/single/spring-cloud-gateway.html#gateway-route-filters)
        - id: algorithmManagerApplication-service
          # 采用 LoadBalanceClient 方式请求,以 lb:// 开头,后面的是注册在 Nacos 上的服务名
          uri: http://localhost:9004/al/**
          # Predicate 翻译过来是“谓词”的意思,必须,主要作用是匹配用户的请求,有很多种用法
          predicates:
          # 路径匹配,以 api 开头,直接配置是不生效的,看 filters 配置
          - Path=/**
          filters:
          # 前缀过滤,默认配置下,我们的请求路径是 http://localhost:8888/business-oauth2/** 这时会路由到指定的服务
          # 此处配置去掉 1 个路径前缀,再配置上面的 Path=/api/**,就能按照 http://localhost:8888/api/** 的方式访问了
          - StripPrefix=1
        - id: dataManagerApplication-service
           # 采用 LoadBalanceClient 方式请求,以 lb:// 开头,后面的是注册在 Nacos 上的服务名
          uri: http://localhost:9001/dat/**
           # Predicate 翻译过来是“谓词”的意思,必须,主要作用是匹配用户的请求,有很多种用法
          predicates:
              # 路径匹配,以 api 开头,直接配置是不生效的,看 filters 配置
          - Path=/**
          filters:
          # 前缀过滤,默认配置下,我们的请求路径是 http://localhost:8888/business-oauth2/** 这时会路由到指定的服务
          # 此处配置去掉 1 个路径前缀,再配置上面的 Path=/api/**,就能按照 http://localhost:8888/api/** 的方式访问了
          - StripPrefix=1
#开启远程调用异常回调
feign:
  hystrix:
    enabled: true


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值