Skip to content

docs: document wildcard custom domains - #392

Merged
pnzrr merged 2 commits into
mainfrom
update/wildcard-domains
Sep 16, 2026
Merged

pnzrr merged 2 commits into
mainfrom
update/wildcard-domains

Conversation

@pnzrr

@pnzrr pnzrr commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Closes #390.

Documents wildcard custom domains (*.sso.yourdomain.com) in docs/self-service/custom-domains.md — one entry that serves every subdomain beneath it, for customers who give each of their customers a branded login URL. Enterprise, and it consumes one custom-domain slot however many subdomains follow.

Structure

Leads with the two DNS records, then spends most of its length on the one thing that goes wrong.

Adding a CNAME per subdomain. It is the intuitive move, it looks harmless, and it breaks that name permanently: it stops the wildcard resolving anything below it, and makes the name impossible to certify — a certificate needs a validation record beneath the name while routing needs a CNAME at it, and DNS allows only one of those. Anyone migrating from per-customer records has to remove them rather than add to them, so it needed saying plainly rather than as a footnote.

The section also explains that the validation record sits beside the customer subdomains rather than beneath any of them, since that is the structural reason the pattern works at all.

Three other things, each of which bit during testing

  • One level only, and it fails as a full-page browser security warning rather than an error — so a customer generating URLs from customer names needs to validate that each yields a single label.
  • Each subdomain is its own token issuer. An application checking a single hardcoded iss rejects every token. This is the likeliest support ticket the feature generates, so it gets its own subsection rather than a bullet.
  • Sessions do not carry across subdomains, since cookies are host-scoped — worth stating because "same realm, same Keycloak" suggests otherwise.

Plus: app association files are unavailable on a wildcard, cross-linked to the existing section that explains exact-hostname matching.

Notes for review

  • Builds clean: docusaurus build succeeds with no MDX errors or broken links.
  • Prettier also realigned one pre-existing table in this file. The file already failed fmt:check on main and CI does not enforce it, but reverting would leave the file half-formatted. Five lines, table padding only.
  • Public repo, so no cluster names, internal hostnames, or customer/prospect identifiers — examples use yourdomain.com and the already-documented {cluster_name}.global.auth.ac.

Ships after the feature is available: backend p2-inc/phasetwo-keycloak#663, dashboard p2-inc/dashboard-v2#281.

🤖 Generated with Claude Code

A wildcard domain (*.sso.yourdomain.com) serves every subdomain beneath it
from a single entry, which is what you want if you give each of your own
customers a branded login URL. Enterprise, and it counts as one custom domain
however many subdomains you go on to serve.

The section leads with the two records needed, then spends most of its length
on the one thing that goes wrong: adding a CNAME per subdomain. That is the
intuitive move, it looks harmless, and it breaks the name permanently --
it stops the wildcard resolving anything below it and makes that name
impossible to certify, because a certificate needs a validation record
beneath the name while routing needs a CNAME at it, and DNS allows only one
of those. Anyone migrating from per-customer records has to remove them
rather than add to them, so this needed saying plainly rather than as a
footnote.

Three other things documented because each has bitten in testing:

- A wildcard covers one level only, and fails as a browser security warning
  rather than an error page -- so customers generating URLs from customer
  names need to validate the shape.
- Each subdomain is its own token issuer. An application checking a single
  hardcoded `iss` rejects every token, which is the likeliest support ticket
  this feature generates.
- Sessions do not carry across subdomains, since cookies are host-scoped.

Prettier also realigned one pre-existing table in this file; the file already
failed fmt:check on main.

Refs #390
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 8, 2026

Copy link
Copy Markdown

Deploying phasetwo-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 01da808
Status: ✅  Deploy successful!
Preview URL: https://8a95b328.phasetwo-docs.pages.dev
Branch Preview URL: https://update-wildcard-domains.phasetwo-docs.pages.dev

View logs

@pnzrr
pnzrr requested a review from xgp September 8, 2026 21:36
The wildcard page noted in one line that a wildcard does not cover its
own parent, and left the reader to work out the rest. The rest turns
out to be the sharpest edge on the whole feature, so it gets a section.

Routing `sso.yourdomain.com` with a CNAME -- the record type every
other custom domain uses, and the one a reader will reach for -- takes
the wildcard down. That name already has records beneath it, and a
CNAME hides everything below it, so every subdomain stops resolving
and the certificate can no longer renew. Neither symptom points back
at the record that caused it. An ALIAS resolves to addresses at the
name instead of pointing at another name, so it does not occlude;
the section names the variants providers use for it, and gives zone
delegation as the fallback rather than letting anyone hardcode an
address they looked up.

It also says the validation record is already there. A wildcard and
its parent validate against the same record, so there is nothing to
add and the certificate is issued straight away -- the opposite of the
"add a record and wait" expectation the page sets everywhere else.

Placed directly after the warning against per-subdomain records, and
opening by distinguishing the two: a record *at* the parent is
expected, a record *beneath* the wildcard is what breaks it. Adjacent
without that contrast, the new section reads as contradicting the
previous one.

The multi-level limit gains the mechanism behind it too. Saying it
"fails on the certificate" undersells it: the name resolves, the edge
routes it, Keycloak answers, and the sole thing standing in the way is
a hostname the certificate does not cover -- which browsers render as
a full-page impersonation warning on the login screen. That is why the
guidance is to validate the label shape before handing out a URL,
rather than to expect a clean error.
@pnzrr
pnzrr merged commit 950478f into main Sep 16, 2026
3 checks passed
@pnzrr
pnzrr deleted the update/wildcard-domains branch September 16, 2026 22:11
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.

Document wildcard custom domains

2 participants