Score:1

Can I route using the leftmost portion of hostname with a wildcard for everything after?

vn flag

I have an application where I would like it to forward traffic based on the highest-order subdomain, rather than the full domain from right to left.

So for example, I have the domains:

  • mydomainone.fake
  • mydomaintwo.fake
  • subdomain.mydomainthree.fake

Is there any way that I could make the following all route to the same backend using a single rule like api.* (by way of the fact that they all start with api):

  • api.mydomainone.fake
  • api.mydomaintwo.fake
  • api.subdomain.mydomainthree.fake

The goal here is to be able to add new tenants (api.subsubdomain.subdomain.mydomainfour.fake) to my application and have it respond dynamically without having to update my load balancing configuration every time a new one is configured to point to my load balancer.

The one negative implication I can think of with this is that anyone would then be able to configure a domain to point to my application. Although my application code will only recognize domains that it's set up with.

Score:1
lv flag

If I understand your concept correctly, then this won't work.
You can have multiple subdomains in a single rule, but you can't have something like api.*.example.com or api.*.com

Number of rules doesn't matter in this case, you will get this error:
Asterisk may only be used as leftmost character preceding '.' or '-'

So you'd have to add every subdomain separately.

vn flag
Right, your example probably also applies to something like `api.*` as well.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.