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
SpringCloud之Gateway组件的简单配置
最新推荐文章于 2024-06-17 16:37:40 发布