Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make single star globs more context-aware and useful #1037

Closed
3 tasks done
netthier opened this issue Nov 15, 2023 · 0 comments · Fixed by #1358
Closed
3 tasks done

Make single star globs more context-aware and useful #1037

netthier opened this issue Nov 15, 2023 · 0 comments · Fixed by #1358
Labels
feature Used for new features
Milestone

Comments

@netthier
Copy link
Contributor

Preflight checklist

Describe the background of your feature request

As of today, <*> will match all characters except / and ., those being separators in paths and hosts respectively.
It always matching both makes it quite useless when used in paths, as it will capture path segments containing dots in an unexpected way.

Describe your idea

Ideally, I would be able to use <*> in hosts to mean "everything except ." and <*> in paths to indicate "everything except /".

First off, the excluded characters should be configurable in a manner as described by @dadrus here:

In principle, there are 4 places for the corresponding configuration:
The default (as present today)
Globally in heimdall' config. This configuration would apply to all rules
On a rule set level. This configuration would apply to all rules in a rule set
In a particular rule as part of the matcher definition.

The more specific one would take precedence.

While supporting all options would give more freedom, I personally don't know, whether all of them are needed at all. Maybe 3 and 4 are fully sufficient. Maybe event just 4 (in addition to 1)

This would allow for at least handling cases where globs are only used in one part of the URL effectively, e.g. to only exclude slashes if the globs are always in paths.

Optimally however, I believe that Heimdall could split up <rule>.match.url into <rule>.match.host and <rule>.match.path. This is closer to the way <rule>.forward_to works today and IMO would also prevent a certain class of errors (I cannot think of a usecase where a glob spanning both the host and the path is a good idea).
The excluded characters could then be configured individually for host and path, with defaults of . and / respectively, meaning the vast majority of users would never need to even touch the defaults to get expected behavior.

Are there any workarounds or alternatives?

The current alternative is using regex matchers instead, which is more error-prone due to the regex being more difficult to read (e.g. [^\/]* for only excluding slashes).

Version

dev

Additional Context

This feature request has a corresponding Discord idea thread here: https://discord.com/channels/1100447190796742698/1121782759191490622/1121782759191490622

@netthier netthier added the feature Used for new features label Nov 15, 2023
@dadrus dadrus added this to the v0.13.0-alpha milestone Nov 15, 2023
@netthier netthier mentioned this issue Nov 15, 2023
3 tasks
@dadrus dadrus modified the milestones: v0.13.0-alpha, v0.14.0-alpha Jan 3, 2024
@dadrus dadrus modified the milestones: v0.14.0-alpha, next Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Used for new features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants