1、 After Route Predicate Factory
Input parameter: the time, after which time the matching request, the example configuration:
spring:
cloud:
gateway:
routes:
- id: after_route
uri: https://anoyi.com
predicates:
- After=2019-11-11T11:11:11.111+08:00[Asia/Shanghai]
2、Before Route Predicate Factory
Input parameter: the time, the time before the match request, the example configuration:
spring:
cloud:
gateway:
routes:
- id: before_route
uri: https://anoyi.com
predicates:
- Before=2019-11-11T11:11:11.111+08:00[Asia/Shanghai]
3、Between Route Predicate Factory
Input two parameters: Time 1, Time 2, the time period matching request, the example configuration:
spring:
cloud:
gateway:
routes:
- id: between_route
uri: https://anoyi.com
predicates:
- Between=2019-11-10T11:11:11.111+08:00[Asia/Shanghai], 2019-11-12T11:11:11.111+08:00[Asia/Shanghai]
4、Cookie Route Predicate Factory
Two input parameters: Cookie name, regular expression matching Cookie in the presence of the name and the value of the regular expression matching, the example configuration:
spring:
cloud:
gateway:
routes:
- id: cookie_route
uri: https://anoyi.com
predicates:
- Cookie=name, ano.i
5、Header Route Predicate Factory
Two input parameters: Header name, regular expression matching Header in the presence of the name and the value of the regular expression matching, the example configuration:
spring:
cloud:
gateway:
routes:
- id: header_route
uri: https://anoyi.com
predicates:
- Header=name, ano.i
6、Host Route Predicate Factory
Input parameter: Host Name expression list, the Header value matches the Host field, the example configuration:
spring:
cloud:
gateway:
routes:
- id: host_route
uri: https://anoyi.com
predicates:
- Host=**.anoyi.cn,**.anoyi.io
7、Method Route Predicate Factory
Input parameter: HTTP Method, matching the request method, the example configuration:
spring:
cloud:
gateway:
routes:
- id: method_route
uri: https://anoyi.com
predicates:
- Method=GET
8、Path Route Predicate Factory
Two input parameters: the Spring PathMatcher
expression list [optional] matchOptionalTrailingSeparator
identification, configuration examples:
spring:
cloud:
gateway:
routes:
- id: host_route
uri: https://anoyi.com
predicates:
- Path=/foo/{segment},/bar/{segment}
9、Query Route Predicate Factory
Two input parameters: a request parameter [optional] regular expression matching similar request address https://anoyi.com/test?hello=world&name=anoyi
request params included, example configuration:
# 仅匹配是否包含参数 hello
spring:
cloud:
gateway:
routes:
- id: query_route
uri: https://anoyi.com
predicates:
- Query=hello
# 匹配参数 name 是否以 ano 开头
spring:
cloud:
gateway:
routes:
- id: query_route
uri: https://anoyi.com
predicates:
- Query=name, ano.*
10、RemoteAddr Route Predicate Factory
Input parameter: IPv4 or IPv6 address lists, the matching request source IP address is in the list, the exemplary configuration:
spring:
cloud:
gateway:
routes:
- id: remoteaddr_route
uri: https://anoyi.com
predicates:
- RemoteAddr=192.168.1.1/24
This article from the blog article multiple platforms OpenWrite release!