Predicates are used in your SpringCloudGatewayRouteConfig to match an incoming request to a route configuration, for example by matching on the request's HTTP Method, or URL path.

The open-source Spring Cloud Gateway project includes a number of built-in predicates that can be used in Spring Cloud Gateway for Kubernetes. For a complete list, see the Spring Cloud Gateway OSS documentation.

Spring Cloud Gateway for Kubernetes also provides custom predicates in addition to those included in the OSS project.

Available predicates

Predicate Description
After matches requests made after a certain datetime
Before matches requests made before a certain datetime
Between matches requests made between two certain datetimes
Cookie matches requests with a certain cookie
Header matches requests with a certain header
Host matches requests with a certain host pattern
Method matches requests to HTTP method (GET/POST)
Path matches requests with path of certain pattern(s)
Query matches requests with certain query parameter (optional with value pattern)
RemoteAddr matches requests of a certain remote IP address
Weight Split requests between a set of targets in a group
JWTClaim Match on JWT claim value

JWTClaim

Match on JWT claim value.

Configuration parameters:

  • header: name of the HTTP header containing the authorization token
  • claim: name of the claim to obtain the value to match from
  • pattern: regular expression specifying the pattern to match
    JWTClaim=Authorization,sub,[email protected]$
check-circle-line exclamation-circle-line close-line
Scroll to top icon