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

Sort by longest URL to shortest by default #266

Open
1 task done
roborourke opened this issue Apr 12, 2022 · 0 comments
Open
1 task done

Sort by longest URL to shortest by default #266

roborourke opened this issue Apr 12, 2022 · 0 comments
Labels
help wanted type:enhancement New feature or request.

Comments

@roborourke
Copy link

Is your enhancement related to a problem? Please describe.

A while back we created some catch-all redirects for some docs, e.g. /docs/* to docs.example.com/

This covers most bases but we started adding some more specific redirects as the new docs site was changing with new pages, pages removed or moved etc...

The problem was that the oldest redirects take effect first.

Designs

Tools like Traefik that match URL patterns to map URLs to docker services use a simple default rule of treating the longest URLs as being the most specific, and process them in that order. There are additional options to set a priority or order in the case of 2 URL patterns being the same length or there being a more important catch-all URL.

The following example is a good illustration, given these 2 URLs:

  • /docs/*
  • /docs/debugging/

/docs/* would match before /docs/debugging/ and therefore /docs/debugging/ would never be used. There is currently no hint to the user this won't work without modifying the Order of the redirect.

A default processing order of longest to shortest would avoid this issue and not require intervention by users, nor the need to understand why their redirects might not be working.

Describe alternatives you've considered

This can be remedied using the existing Order field so I'd say this is low priority.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@roborourke roborourke added the type:enhancement New feature or request. label Apr 12, 2022
@jeffpaul jeffpaul added this to the Future Release milestone Jun 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted type:enhancement New feature or request.
Projects
None yet
Development

No branches or pull requests

2 participants