feat: guard certificate orders for custom domains and explain the setup
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / test (pull_request) Successful in 8m21s
ci / lint (pull_request) Successful in 11m0s
ci / build (pull_request) Canceled after 8m49s
ci / image (pull_request) Canceled after 0s

Status page servers order certificates on demand. Verified domains were
already the only ones they would order for, but nothing bounded how many:
an organization switching domains, or many organizations at once, could use
up the CA's rate limits that all servers sharing an ACME account depend on,
and every handshake or request for a made-up name was passed on to the API.

- Before a new order (not a renewal) the server asks the API
  (POST /agent/v1/certificates). It allows verified domains of pages that
  server serves, within limits per domain and day, per organization and
  day, and per ACME account owner and hour (UPTIME_CERTS_*), counted
  across all instances.
- An organization can set a new custom domain at most 10 times a day.
- The server remembers names without a page for a minute and passes at
  most 20 unknown names a second on to the API; pages the sync cached are
  not affected. Only real pages are recorded as visited.
- The page editor explains the three steps: the TXT record, the CNAME
  record with the platform's status page host as its target (or the
  organization's own servers), apex domains, and when HTTPS follows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
Sebastian UnterschützandClaude Opus 5.5 committed 2026-11-25 22:39:01 +01:00
1 parent 7509b8c429
commit db36d918fe
18 files changed
+787 -161

No files matched your search

+42 -15
View File
@@ -106,6 +106,11 @@ type PageEditor struct {
URL string
Domain string
DomainVerified bool
// CNAMETarget is the host of the platform's status page servers that
// custom domains point at; empty when unknown.
CNAMETarget string
// DomainChangesPerDay is how often the domain may be changed a day.
DomainChangesPerDay int
RecordName string
RecordValue string
Suspended bool
@@ -290,27 +295,49 @@ templ StatusPageEditor(p Page, me Me, e PageEditor) {
</section>
<section>
@sectionHeading("pages.domain")
<p class="mb-4 text-sm text-muted">{ i18n.T(ctx, "pages.domain_intro") }</p>
<form data-api={ "/org/statuspages/" + e.ID + "/domain" } data-method="put" data-next={ "/statuspages/" + e.ID }>
@formError()
@valueField(i18n.T(ctx, "pages.domain_name"), "domain", e.Domain, "status.example.com", false)
@submit(i18n.T(ctx, "common.save"))
</form>
if e.Domain != "" {
<div class="mt-6 border border-rule p-4 text-sm">
if e.DomainVerified {
<p><span class="text-up">●</span> { i18n.T(ctx, "pages.domain_verified") }</p>
<p class="mt-2 text-xs text-muted">{ i18n.T(ctx, "pages.domain_cname") }</p>
} else {
<p class="mb-3">{ i18n.T(ctx, "pages.domain_instructions") }</p>
<dl class="mb-4 grid grid-cols-[max-content_1fr] gap-x-4 gap-y-1 font-mono text-xs">
<dt class="text-muted">TXT</dt>
<dd class="break-all">{ e.RecordName }</dd>
<dt class="text-muted">{ i18n.T(ctx, "pages.value") }</dt>
<dd class="break-all">{ e.RecordValue }</dd>
</dl>
<button type="button" data-post={ "/org/statuspages/" + e.ID + "/domain/verify" } data-ok={ i18n.T(ctx, "pages.domain_verified") } data-reload class="border border-ink px-3 py-1.5 text-sm hover:bg-ink hover:text-paper">{ i18n.T(ctx, "pages.verify") }</button>
}
</div>
<ol class="mt-6 space-y-5 border border-rule p-4 text-sm">
<li>
if e.DomainVerified {
<p><span class="text-up">●</span> { i18n.T(ctx, "pages.domain_step_verified") }</p>
} else {
<p class="mb-3">{ i18n.T(ctx, "pages.domain_step_verify") }</p>
<dl class="mb-4 grid grid-cols-[max-content_1fr] gap-x-4 gap-y-1 font-mono text-xs">
<dt class="text-muted">TXT</dt>
<dd class="break-all">{ e.RecordName }</dd>
<dt class="text-muted">{ i18n.T(ctx, "pages.value") }</dt>
<dd class="break-all">{ e.RecordValue }</dd>
</dl>
<button type="button" data-post={ "/org/statuspages/" + e.ID + "/domain/verify" } data-ok={ i18n.T(ctx, "pages.domain_verified") } data-reload class="border border-ink px-3 py-1.5 text-sm hover:bg-ink hover:text-paper">{ i18n.T(ctx, "pages.verify") }</button>
}
</li>
<li>
switch {
case e.OwnServers:
<p>{ i18n.T(ctx, "pages.domain_step_cname_own") }</p>
case e.CNAMETarget != "":
<p class="mb-3">{ i18n.T(ctx, "pages.domain_step_cname") }</p>
<dl class="grid grid-cols-[max-content_1fr] gap-x-4 gap-y-1 font-mono text-xs">
<dt class="text-muted">CNAME</dt>
<dd class="break-all">{ e.Domain }</dd>
<dt class="text-muted">{ i18n.T(ctx, "pages.value") }</dt>
<dd class="break-all">{ e.CNAMETarget + "." }</dd>
</dl>
default:
<p>{ i18n.T(ctx, "pages.domain_step_cname_unknown") }</p>
}
<p class="mt-2 text-xs text-muted">{ i18n.T(ctx, "pages.domain_apex") }</p>
</li>
<li>
<p class="text-xs text-muted">{ i18n.T(ctx, "pages.domain_step_tls", "Count", e.DomainChangesPerDay) }</p>
</li>
</ol>
}
</section>
</div>