|
@@ -14,36 +14,36 @@ spring:
|
|
|
#配置路由,可以配置多组
|
|
#配置路由,可以配置多组
|
|
|
routes:
|
|
routes:
|
|
|
#配置路由的id,需要全局唯一,查询数据使用该路由
|
|
#配置路由的id,需要全局唯一,查询数据使用该路由
|
|
|
- - id: member10001
|
|
|
|
|
- #路由转发的URI,最终转发的URL = URI + PATH
|
|
|
|
|
- #uri: http://localhost:10001
|
|
|
|
|
- #使用负载均衡
|
|
|
|
|
- uri: lb://member-service-provider
|
|
|
|
|
- #配置路由的断言,满足条件时才进行路由
|
|
|
|
|
- predicates:
|
|
|
|
|
- #路径断言,参数为正则表达式字符串列表,多个则使用逗号分割,正则表达式中使用具名捕获分组,则捕获分组的值可以在过滤器中使用
|
|
|
|
|
- - Path=/member-gateway/member
|
|
|
|
|
- #方法断言,参数为请求方法的字符串列表,多个则使用逗号分割
|
|
|
|
|
- - Method=GET
|
|
|
|
|
- #后置时间断言,时间格式为ZonedDateTime
|
|
|
|
|
- #- After=2025-09-10T19:01:03.749+08:00[Asia/Shanghai]
|
|
|
|
|
- #前置时间断言,时间格式为ZonedDateTime
|
|
|
|
|
- #- Before=2025-09-11T19:01:03.749+08:00[Asia/Shanghai]
|
|
|
|
|
- #时间区间断言,两个参数,只有在时间区间的的请求才能通过断言,时间格式为ZonedDateTime
|
|
|
|
|
- #- Between=2025-09-10T19:01:03.749+08:00[Asia/Shanghai],2025-09-11T19:01:03.749+08:00[Asia/Shanghai]
|
|
|
|
|
- #cooike断言,格式为: "name,value",name为cookie的名称,value为cookie的值,value为正则表达式
|
|
|
|
|
- #- Cookie=name,value
|
|
|
|
|
- #Header断言,第一个参数为请求头的名称,第二个参数为请求头的值(正则表达式),格式为:name,value
|
|
|
|
|
- #- Header=name,value
|
|
|
|
|
- #Host断言,参数为Ant格式的符合Host格式的字符串列表,多个则使用逗号分割
|
|
|
|
|
- #- Host=localhost,127.0.0.1,**.space
|
|
|
|
|
- filters:
|
|
|
|
|
- #重写路径,将请求路径中的member-gateway替换为member-provider,使用到正则表达式的命名捕获分组,语法格式:(?<捕获分组名称>pattern),引用捕获分组:$\{捕获分组名称}
|
|
|
|
|
- - RewritePath=/member-gateway/(?<segment>.*), /member-provider/$\{segment}
|
|
|
|
|
- #添加请求头,两个参数,第一个参数为请求头的名称,第二个参数为请求头的值,参数可以使用断言中定义的具名捕获分组
|
|
|
|
|
- #- AddRequestHeader=headerName,headerValue
|
|
|
|
|
- #添加请求参数,两个参数,第一个参数为请求参数的名称,第二个参数为请求参数的值,参数可以使用断言中定义的具名捕获分组
|
|
|
|
|
- - AddRequestParameter=parameterName,parameterValue
|
|
|
|
|
|
|
+# - id: member10001
|
|
|
|
|
+# #路由转发的URI,最终转发的URL = URI + PATH
|
|
|
|
|
+# #uri: http://localhost:10001
|
|
|
|
|
+# #使用负载均衡
|
|
|
|
|
+# uri: lb://member-service-provider
|
|
|
|
|
+# #配置路由的断言,满足条件时才进行路由
|
|
|
|
|
+# predicates:
|
|
|
|
|
+# #路径断言,参数为正则表达式字符串列表,多个则使用逗号分割,正则表达式中使用具名捕获分组,则捕获分组的值可以在过滤器中使用
|
|
|
|
|
+# - Path=/member-gateway/member
|
|
|
|
|
+# #方法断言,参数为请求方法的字符串列表,多个则使用逗号分割
|
|
|
|
|
+# - Method=GET
|
|
|
|
|
+# #后置时间断言,时间格式为ZonedDateTime
|
|
|
|
|
+# #- After=2025-09-10T19:01:03.749+08:00[Asia/Shanghai]
|
|
|
|
|
+# #前置时间断言,时间格式为ZonedDateTime
|
|
|
|
|
+# #- Before=2025-09-11T19:01:03.749+08:00[Asia/Shanghai]
|
|
|
|
|
+# #时间区间断言,两个参数,只有在时间区间的的请求才能通过断言,时间格式为ZonedDateTime
|
|
|
|
|
+# #- Between=2025-09-10T19:01:03.749+08:00[Asia/Shanghai],2025-09-11T19:01:03.749+08:00[Asia/Shanghai]
|
|
|
|
|
+# #cooike断言,格式为: "name,value",name为cookie的名称,value为cookie的值,value为正则表达式
|
|
|
|
|
+# #- Cookie=name,value
|
|
|
|
|
+# #Header断言,第一个参数为请求头的名称,第二个参数为请求头的值(正则表达式),格式为:name,value
|
|
|
|
|
+# #- Header=name,value
|
|
|
|
|
+# #Host断言,参数为Ant格式的符合Host格式的字符串列表,多个则使用逗号分割
|
|
|
|
|
+# #- Host=localhost,127.0.0.1,**.space
|
|
|
|
|
+# filters:
|
|
|
|
|
+# #重写路径,将请求路径中的member-gateway替换为member-provider,使用到正则表达式的命名捕获分组,语法格式:(?<捕获分组名称>pattern),引用捕获分组:$\{捕获分组名称}
|
|
|
|
|
+# - RewritePath=/member-gateway/(?<segment>.*), /member-provider/$\{segment}
|
|
|
|
|
+# #添加请求头,两个参数,第一个参数为请求头的名称,第二个参数为请求头的值,参数可以使用断言中定义的具名捕获分组
|
|
|
|
|
+# #- AddRequestHeader=headerName,headerValue
|
|
|
|
|
+# #添加请求参数,两个参数,第一个参数为请求参数的名称,第二个参数为请求参数的值,参数可以使用断言中定义的具名捕获分组
|
|
|
|
|
+# - AddRequestParameter=parameterName,parameterValue
|
|
|
#第二组路由,新增数据使用该路由
|
|
#第二组路由,新增数据使用该路由
|
|
|
- id: member10002
|
|
- id: member10002
|
|
|
uri: http://localhost:10002
|
|
uri: http://localhost:10002
|