2 min • read

Query parameter-based routing

Emissary-ingress can route to target services based on HTTP query parameters with the query_parameters and regex_query_parameters specifications. Multiple mappings with different annotations can be applied to construct more complex routing rules.

The query_parameters annotation

The query_parameters attribute is a dictionary of query_parameter: value pairs. Emissary-ingress will only allow requests that match the specified query_parameter: value pairs to reach the target service.

You can also set the value of a query parameter to true to test for the existence of a query parameter.

A basic example

This will allow requests to /backend/ to succeed only if the quote-mode query parameter has the value backend and the random-query-parameter has the value datawire.

A conditional example

This will send requests that contain the quote-mode query parameter to the quote-mode target, while routing all other requests to the quote-regular target.

regex_query_parameters

The following mapping will route requests with the quote-mode header that contain values that match the regex.