-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Feature Request: Routing based on HTTP query string #2120
Description
Title: Routing based on HTTP query string
Motivation:
For some applications, the HTTP query string carries information useful for routing. The prefix, path, and regex fields in the Route configuration structure only match on the part of the :path prior to the ?.
Proposal:
Add one new field to the Route configuration structure:
query_regex
(optional, string) Indicates that, in addition to prefix, path, or regex, the route additionally requires a regular expression match on the query string. The entire query string (minus the leading ?) must match the regex.
Notes
- If there's interest in this, I am willing to contribute an implementation.
Alternatives
Another way to achieve a similar result would be to support a structured config instead of a regular expression; e.g.,
"query_matches": [
{
"key": "env",
"value": "test"
},
{
"key": "user_id",
"regex": "\d+[02468]"
}
]
This approach would be more expressive than a single regex, but it would add more complexity to the HTTP connection manager filter.