For other methods of request matching, see Match incoming requests.

Configuration

In a RouteTable resource, add the following matchers section to your route:

  
...
  http:
  - matchers:
    - queryParameters:
      - name: <key_name>
        value: <key_value>
        regex: <true|false>
    ...
  
FieldDescription
nameThe name of a key that must be present in the requested path’s query string.
valueThe value of the query parameter.
regexWhether the query parameter value is written as a regular expression. Defaults to false.


For more information, see the Gloo Mesh Gateway API docs for route tables and for request matching.

Examples

For example, consider the following route table.

  apiVersion: networking.gloo.solo.io/v2
kind: RouteTable
metadata:
  name: query-parameters-match
  namespace: global
spec:
  hosts:
    - 'one.solo.io'
  virtualGateways:
    - name: istio-ingressgateway
      namespace: bookinfo
      cluster: ${CLUSTER_NAME}
  http:
  - matchers:
    - queryParameters:
      - name: <key_name>
        value: <key_value>
        regex: <true|false>
    forwardTo:
      destinations:
      - ref:
          name: myapp
          namespace: global
          cluster: ${CLUSTER_NAME}
        port:
          number: 8090
        kind: SERVICE
  

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: The ingress gateway forwards all requests to one.solo.io that include the query key ?version to the myapp destination.

  
    - queryParameters:
      - name: version
  

Match query key name and value: The ingress gateway forwards all requests to one.solo.io that include the query ?version=stage to the myapp destination.

  
    - queryParameters:
      - name: version
        value: stage
  

Match query key name and regex-defined value: The ingress gateway forwards all requests to one.solo.io that include queries such as ?version=stagev3 or ?version=stagev1 to the myapp destination.

  
    - queryParameters:
      - name: version
        value: stagev.*
        regex: true
  

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.