Skip to content

feat: support wildcard custom domains in gateway#545

Merged
kvinwang merged 2 commits intomasterfrom
feat/gateway-wildcard-custom-domain
Mar 17, 2026
Merged

feat: support wildcard custom domains in gateway#545
kvinwang merged 2 commits intomasterfrom
feat/gateway-wildcard-custom-domain

Conversation

@kvinwang
Copy link
Collaborator

@kvinwang kvinwang commented Mar 16, 2026

Summary

Add fallback to _dstack-app-address-wildcard.{parent} TXT record
when exact _dstack-app-address.{sni} lookup fails. This allows a
single TXT record to route all subdomains of a custom domain to the
same app, while still allowing per-subdomain overrides via exact records.

Lookup order

  1. _dstack-app-address.{sni} — exact match
  2. _tapp-address.{sni} — legacy compat
  3. _dstack-app-address-wildcard.{parent} — wildcard fallback

Test plan

  • Verify existing exact custom domain resolution still works — exact-test.test111.kvin.wang resolved via _dstack-app-address.exact-test.test111.kvin.wang TXT, cert CN=exact-test.test111.kvin.wang
  • Test wildcard fallback with _dstack-app-address-wildcard TXT record — foo.test111.kvin.wang resolved via _dstack-app-address-wildcard.test111.kvin.wang, cert CN=*.test111.kvin.wang
  • Test exact record overrides wildcard for specific subdomains — exact-test.test111.kvin.wang (app fdd0dbc3...) and foo.test111.kvin.wang (app 8de234a6...) route to different VMs with different certs

Add fallback to `_dstack-app-address-wildcard.{parent}` TXT record
when exact `_dstack-app-address.{sni}` lookup fails. This allows a
single TXT record to route all subdomains of a custom domain to the
same app, while still allowing per-subdomain overrides via exact records.
The else branch used ? operator which returned error immediately on
exact lookup failure, preventing the wildcard fallback from executing.
Use if-let instead to fall through gracefully.
@kvinwang kvinwang merged commit 20091a8 into master Mar 17, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant