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

Unable to override wildcard hostname with specific hostname #147

Closed
yunruiwatts opened this issue May 1, 2018 · 2 comments
Closed

Unable to override wildcard hostname with specific hostname #147

yunruiwatts opened this issue May 1, 2018 · 2 comments
Milestone

Comments

@yunruiwatts
Copy link

This is regarding the wildcard hostname support that was added with #32. It appears that as a consequence of sorting the servers by their hostname the wildcard will always sort before specific - * comes before alphanumeric character when sorting strings. As a result, it is not possible to have a specific rule beat out a wildcard rule.

Ideally we should be able to do the same thing that we can do with DNS - define *.example.com to go to one location, but allow api.example.com to be overridden and go to a different location.

I'm not sure the best way to do this - a quick and easy way to do this would be to sort in reverse so that * would be used last, but that would affect everyone even if they don't have any wildcard rules. Another option would be to find or implement a sort that sorts alphanumeric characters ahead of other characters. One other option that should work but less is than ideal (but is potentially faster than implementing a new sort) is to simply check if a hostname has a * in it, and if so sort it after the other hostname unless the other hostname also has a * in it.

Also, I'm not sure how this would affect regex hostnames. My guess is that those should probably also go after non-regex, non-wildcard hostnames, so ideally whatever solution we use would do that.

@yunruiwatts
Copy link
Author

Oh, I forgot to mention that I'm happy to do a pull request with whatever solution we decide would be best, but I wanted to have a discussion about what solution would be best first.

@westse
Copy link

westse commented May 1, 2018

+1 for this. The following sort order makes sense to me (earlier take precedence over later):

  1. Normal hostnames (non-wildcard, non-regex)
  2. regex hostnames
  3. wildcard hostnames

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants