You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Match a REGEX path rule against the path without its query #1909
A REGEX path rule is matched against the request path together with its query string. A pattern written for the path can therefore consume the query, or be defeated by it:
/api/.+ matches /api/?x=1, although the path /api/ does not match it;
^/api/v2$ does not match /api/v2?x=1, although its path does.
Matching the query through a path regex is useful in its own right, so this is not a bug report. But there is currently no way to match a regex against the path alone.
Use case
In Sōzune, Gateway API HTTPRoutes can declare a RegularExpression path match, which applies to the path only, as it does in Traefik's PathRegexp or Envoy's safe_regex. Mapping it onto a Sōzu REGEX rule requires rewriting the user's pattern so it can never reach the query (stripping ? from character classes, dropping its anchors, and so on), which is fragile and changes the meaning of some patterns. Checking the regex after routing instead loses the fall-through to the next frontend when it fails.
Proposal
A path rule kind, or an option on REGEX, that matches the regex against the path only, up to the first ?.
The open question is how rewrite_path should behave for such a rule: its $PATH[n] captures would no longer see the query, so the rewritten path would presumably need the original query appended to it.
Activity
chore(release): prepare 2.3.4 (#1920)