gateway-路由方式说明

gateway 路由方式

1、cookie路由

spring:
cloud:
gateway:
routes:
- id: after_route
uri: https://example.org
predicates:
- Cookie=mycookie,mycookievalue
完全展开的参数
spring:
cloud:
gateway:
routes:
- id: after_route
uri: https://example.org
predicates:
- name: Cookie
args:
name: mycookie
regexp: mycookievalue
gateway-路由方式说明

 

 2 After route predicate /Before route predicate  / Between Route Predicate

spring:
cloud:
gateway:
routes:
- id: after_route
uri: https://example.org
predicates:
#在这时间之后可以访问
- After=2021-01-20T17:42:47.789-07:00[America/Denver]
spring:
cloud:
gateway:
routes:
- id: after_route
uri: https://example.org
predicates:
#在这时间之前可以访问
- Before=2020-01-20T17:42:47.789-07:00[America/Denver]
spring:
cloud:
gateway:
routes:
- id: after_route
uri: https://example.org
predicates:
#在这时间之间可以访问
- Between=2017-01-20T17:42:47.789-07:00[America/Denver], 2023-01-21T17:42:47.789-07:00[America/Denver]

 3、Header Route Predicate

spring:
cloud:
gateway:
routes:
- id: after_route
uri: https://example.org
predicates:
#如果请求的标头名称X-Request-Id\d+正则表达式匹配(即,它的值为一位或多位数字),则此路由匹配
- Header=X-Request-Id, \d+

4、Host Route Predicate 主机路由

spring:
cloud:
gateway:
routes:
- id: after_route
uri: https://example.org
predicates:
#主机路由 即访问的主机地址
- Host=**.myxxljob.com,**.anotherhost.org

gateway-路由方式说明

 

 

5、Method Route Predicate 方法路由

spring:
cloud:
gateway:
routes:
- id: after_route
uri: https://example.org
predicates:
#方法路由
- Method=GET

 

6、Path Route Predicate  路径路由

spring:
cloud:
gateway:
routes:
- id: after_route
uri: https://example.org
predicates:
#路径路由
- Path=/red/{segment},/blue/{segment}

 

7、Query Route Predicate  查询路由

spring:
cloud:
gateway:
routes:
- id: after_route
uri: https://example.org
predicates:
#查询路由谓词工厂
- Query=green

 

8、RemoteAddr Route Predicate 

spring:
cloud:
gateway:
routes:
- id: remoteaddr_route
uri: https://example.org
predicates:
#RemoteAddr 路由
- RemoteAddr=192.168.1.1/24

 

9、Weight Route Predicate  权重路由

spring:
cloud:
gateway:
routes:
- id: weight_high
uri: https://weighthigh.org
predicates:
- Weight=group1, 5
- id: weight_low
uri: https://weightlow.org
predicates:
- Weight=group1, 5

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 




















































gateway-路由方式说明

 

gateway-路由方式说明

上一篇:使用 Dockerfile 自定义 Nginx 镜像


下一篇:js冒泡排序