There are three basic concepts around Spring Cloud Gateway:
- Route: That is the basic building block of the gateway. It consists of a unique ID for identifying a route, a destination URI, a list of predicates, and a list of filters. A route is matched only if all the predicates have been fulfilled.
- Predicates: These are the logic that is executed before processing each request. It is responsible for detecting whether the different attributes of the HTTP request, such as headers and parameters, match the defined criteria. The implementation is based on the Java 8 interface
java.util.function.Predicate<T>
. The input type is in turn based on Spring'sorg.springframework.web.server.ServerWebExchange
. - Filters: They allow the modification of the incoming HTTP request or outgoing HTTP response. They may be modified before or after sending the downstream request. Route filters are scoped to a particular route. They implement Spring's
org.springframework.web.server.GatewayFilter...