Support Wildcard Hosts in Tenant Configuration

Feature Request: Support Wildcard Hosts in Tenant Configuration

Description:
Currently, the Tenant configuration allows defining specific hostnames for each tenant, but it does not support wildcard patterns. This limitation makes it difficult to handle dynamic subdomains efficiently. I propose adding support for wildcard hosts so that a tenant can be assigned to multiple subdomains dynamically.

Use Case:
In multi-tenant applications, it’s common to allow subdomains for different users or organizations. For example:

  • company1.example.com
  • company2.example.com
  • *.example.com (should match any subdomain under example.com)

Right now, every subdomain must be explicitly listed, making the system harder to manage when many subdomains are involved. Especially when features-branches gets their own domain.

Proposed Solution:
Extend the host matching logic to support wildcard patterns (*). A host pattern like *.example.com should match any subdomain under example.com. This will allow:

  • Easier tenant setup without manually specifying each subdomain.
  • More flexible routing mechanisms.
  • Support for dynamic subdomain-based tenancy.

Example Implementation:
The find(forHost:) method should be updated to check for wildcard patterns and match accordingly. For instance:

  • foo.bar.example.com should match *.bar.example.com
  • sub.example.com should match *.example.com

Potential Challenges:

  • Performance considerations for checking wildcard patterns.
  • Ensuring correct matching logic to avoid unintended overlaps.

Would love to hear feedback from the community on this!

Here is a PR: Allow Wildcard Hosts by KrisSimon · Pull Request #23 · uitsmijter/Uitsmijter · GitHub