Query parameter matching
Specify a set of URL query parameters which requests must match in entirety.
For example, if you specify a set of URL query parameters in a route table for service B, a request from service A in your mesh to service B must contain the entire set of URL query parameters in order for the request to be routed. For other methods of request matching, see Match incoming requests.
Configuration
In a RouteTable resource, add the following matchers
section to your route:
Field | Description |
---|---|
name | The name of a key that must be present in the requested path’s query string. |
value | The value of the query parameter. |
regex | Whether the query parameter value is written as a regular expression. Defaults to false. |
For more information, see the Gloo Mesh Enterprise API docs for route tables and for request matching.
Examples
For example, consider the following route table.
To achieve the following example request matches, you might use these combinations of queryParameters
settings. Remember that requests must match all specified query parameters.
Match only query key name: Requests to the host that include the query key ?version
are routed to the myapp
destination.
Match query key name and value: Requests to the host that include the query ?version=stage
are routed to the myapp
destination.
Match query key name and regex-defined value: Requests to the host that include queries such as ?version=stagev3
or ?version=stagev1
are routed to the myapp
destination.
Next steps
Check out the guides in Forward requests to a destination to further build your route tables based on the destination type, and apply the route tables to your ingress gateway.