Skip to content

Feature Request: Routing based on HTTP query string #2120

@brian-pane

Description

@brian-pane

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.

Metadata

Metadata

Assignees

Labels

beginnerGood starter issues!enhancementFeature requests. Not bugs or questions.help wantedNeeds help!

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions