In the Hello World example, we saw how Gloo uses a Virtual Service Custom Resource (CR) to allow users to specify routes to a particular destination, or Upstream. Each route on a Virtual Service includes a matcher, specifying the rules to determine if a request should be passed along the route. In the basic example, we used an exact match for a particular path. We’ll now look at how to configure a route on a Virtual Service with different kinds of matching logic and matchers.
The following are the different aspects of the request that you can match against a route rule. Each aspect is combined with the others in a logical
AND, i.e. all aspects must test
true for the route to match and the specified route action to be taken.
Path Matching: Match requests to routes based on the context path
Header Matching: Matching based on incoming or generated headers
Query Parameter Matching: Request to route matching based on query parameters
HTTP Method Matching: Match requests to routes based on HTTP method
We recommend starting with Path Matching first and then reviewing the other matching types in turn.