What is Domain Connect?
Domain Connect is an open protocol that lets service providers (us) configure DNS records on a user’s domain with one click, instead of asking them to copy-paste CNAME and TXT values manually. The user gets redirected to their DNS provider (e.g. Cloudflare), approves the changes, and the records are created automatically.How it works in our stack
Components
Template
The Domain Connect template defines what DNS records we need. It lives in the public Domain-Connect/templates repo asunkey.com.custom-domain.json.
| Setting | Value | Why |
|---|---|---|
providerId | unkey.com | Our provider identifier |
serviceId | custom-domain | Service identifier |
hostRequired | true | Subdomains only (apex uses manual setup) |
syncBlock | false | Synchronous flow (required by Cloudflare) |
syncPubKeyDomain | domainconnect.unkey.com | Where providers fetch our public key |
syncRedirectDomain | app.unkey.com | Where providers redirect after approval |
| Type | Host | Value |
|---|---|---|
| CNAME | @ | %target% (full CNAME target, e.g. abc123.unkey-dns.com) |
| TXT | _unkey | unkey-domain-verify=%verificationToken% |
dc-template-linter -cloudflare unkey.com.custom-domain.json.
Signing keypair
Domain Connect requires all requests to be digitally signed (RS256). We have an RSA keypair:- Public key: published as DNS TXT records at
_dcpubkeyv1.domainconnect.unkey.com, split into two parts (p=1andp=2) due to TXT record size limits - Private key: stored in AWS Secrets Manager under
unkey/controlasUNKEY_DOMAIN_CONNECT_PRIVATE_KEY(PEM format)
infra/pulumi/projects/dns/unkey-com/main.go.
Discovery library
We userailwayapp/domainconnect-go which handles:
- DNS provider discovery (NS lookup →
_domainconnect.{provider}TXT check) - Sync URL construction with all required parameters
- RS256 signing with our private key
pkg/dns/domainconnect/discover.go.
Code
Discovery and signing live inpkg/dns/domainconnect/. The ctrl service calls Discover() during AddCustomDomain and persists the result. If no private key is configured, Domain Connect is silently disabled.
Supported DNS providers
Any provider that publishes a_domainconnect.{provider-domain} TXT record is automatically supported. As of now:
| Provider | Notes |
|---|---|
| Cloudflare | Template onboarded via email to domain-connect@cloudflare.com |
| Vercel DNS | Auto-discovered |
| DigitalOcean, Name.com, Hostinger, Dynadot, Namesilo | Use Cloudflare under the hood |
| IONOS | Own Domain Connect endpoint |
Key rotation
If you need to rotate the signing keypair:- Generate a new keypair:
-
Update the DNS TXT records at
_dcpubkeyv1.domainconnect.unkey.comwith the new public key chunks -
Update
UNKEY_DOMAIN_CONNECT_PRIVATE_KEYin AWS Secrets Manager (unkey/control) - Restart ctrl service to pick up the new key
Verifying the setup
Check public key is published
Verify a signature
Go to exampleservice.domainconnect.org/sig, enter:- Key:
_dcpubkeyv1 - Domain:
domainconnect.unkey.com - Paste the query string and signature from a generated URL

