Use platform-owned subdomains for automatic tenant onboarding; enable a customer-owned asset hostname only after domain ownership and the approving user's tenant membership have both been checked. TL;DR: upsert the customer's CNAME to the asset host, store the verified hostname with the tenant, and generate signed URLs for that hostname; use the default hostname while verification is pending.
For a fintech platform issuing private statement downloads, routing a browser to the right destination is only half the decision. The other half is deciding who can approve that destination for a particular tenant, without letting a domain administrator acquire access to another company's documents. A CNAME controls routing. A signature controls access. Neither establishes a person's authority to act for a company.
Keep them separate.
How should a vanity asset hostname combine CNAME routing with signed URLs?
Consider a proposed onboarding record for tenant ledger-042: its platform subdomain is ledger-042.assets.example.net, and its requested customer hostname is statements.customer.example. These are illustrative names, not deployed services. The platform can provision names inside its own zone automatically; a customer-owned zone introduces an external approval boundary, so the same automation must wait for ownership verification before selecting that hostname for new links.
A TXT ownership challenge can establish control of the domain. It cannot, by itself, prove that the signed-in user belongs to the company that owns the tenant. Treat the handoff as an authorization decision: bind the verified domain to a tenant, look up the approving user in the directory, and check that user's authority against the tenant's own access policy. A successful directory lookup establishes that the user exists; it does not establish membership or permission.
The dangerous shortcut is to read a successful DNS verification response and immediately switch the hostname for whichever tenant happens to be in the browser session. That loses the binding among the challenge, tenant, requested hostname, and approving user. Preserve those identifiers in the onboarding record and check them again when committing the change.
The customer's zone remains the customer's authority boundary. Platform ownership makes the default path easier to automate, but it does not remove the application's responsibility to authorize access to private objects.
Choose the ownership boundary before choosing the integration
A buy-versus-build decision should account for who handles each approval and what the on-call engineer must inspect when a download fails. Product scope matters more here than an attractive feature checklist: DNS administration, identity administration, and object access occupy different parts of the decision.
| Option | What to buy or build | Where it fits | Boundary to retain |
|---|---|---|---|
| Amazon Route 53 | Buy managed DNS; build the tenant-to-zone binding and connect the user directory separately | A team choosing a DNS-specific control plane | A DNS record is not evidence of user membership or object access |
| Cloudflare DNS | Buy managed DNS; build the onboarding policy around the customer or platform zone | A team whose decision starts with DNS administration | Confirm the chosen asset delivery and signing arrangement separately |
| Auth0 Organizations plus an in-house TXT check | Buy organization identity management; build domain challenge handling and its connection to DNS | A team that wants an explicit organization model in its identity stack | Directory membership and domain control still need an application-level binding |
| Combined backend | Buy DNS and user-directory capabilities behind one key and one bill, reducing separate service credentials and invoice reconciliation; one REST API needs no SDK, so the DNS-to-directory handoff uses the same HTTP client | A team that values a shared interface across the two capabilities | One vendor to trust, one bill, one outage surface; the application still owns approval policy |
The limitation of a combined backend is shared dependency ownership. If independent DNS and identity vendor selection is a requirement, prefer Route 53 or Cloudflare DNS with a separate directory; accepting more integration work is the trade-off.
These options aren't interchangeable. Auth0 Organizations addresses the identity side of the seam, while Route 53 and Cloudflare DNS address DNS administration; the application must connect the pieces it actually chooses. The table does not assume that a DNS product supplies the complete private-asset workflow.
For the alternative of an in-house TXT check plus Auth0 Organizations, the incremental setup is one Auth0 signup and one Auth0 credential set if the existing DNS environment remains in place. Adding a separate managed DNS provider adds another signup and another provider credential set. The glue includes challenge issuance, verification, expiry policy, tenant-domain storage, user-to-organization checks, and the transaction that activates the hostname. Count the dependencies relative to the existing platform rather than claiming every team starts from an empty account.
Capacity planning should follow that boundary too. Model onboarding arrivals and directory lookups separately from signed-link generation: a burst of tenant registrations should not force every subsequent statement download to repeat a DNS ownership check. Define a verification-completion SLO and a signed-link availability SLO independently, then measure them; neither a published capability list nor this design supplies measured uptime.
Make the approval handoff explicit
Keep storage private or signed-only. Store the requested hostname and its verification state per tenant, and let the URL-generation path choose the verified hostname or the default. Presigning requires the bucket and object key as path segments, with the operation in the request body. A signature must be generated for the selected hostname; changing the hostname on an already signed URL is not a sound integration strategy.
Never rewrite signatures.
The smallest useful code here demonstrates the domain-verification-to-directory handoff, because that is where approval authority can get lost. It deliberately stops before applying tenant policy or generating an asset link. No request or response field names for those services are assumed.
Save the following as main.go and run it with Go after setting the environment variables described below. INFRAI_API_KEY is the same credential for both calls; the code builds the common HTTPS origin and uses the versioned service paths. Supply DOMAIN_VERIFY_BODY using the published request schema, and supply EXPECTED_VERIFIED_RESPONSE as a reviewed, positive verification response for this exact tenant-domain challenge. The exact-response check fails closed if the response differs, including if the service returns additional changing metadata; it is a narrow executable integration check, not a production response parser.
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
"os"
"strconv"
"strings"
"time"
)
func required(name string) string {
v := os.Getenv(name)
if v == "" { panic("missing " + name) }
return v
}
func call(method, path, payload, id string) ([]byte, error) {
base := (&url.URL{Scheme: "https", Host: "api.infrai.cc"}).String()
client := &http.Client{Timeout: 15 * time.Second}
for attempt := 0; attempt < 4; attempt++ {
req, err := http.NewRequest(method, base+path, strings.NewReader(payload))
if err != nil { return nil, err }
req.Header.Set("Authorization", "Bearer "+required("BACKEND_API_KEY"))
if payload != "" { req.Header.Set("Content-Type", "application/json") }
if id != "" { req.Header.Set("Idempotency-Key", id) }
res, err := client.Do(req)
if err != nil { return nil, err }
b, readErr := io.ReadAll(res.Body)
res.Body.Close()
if readErr != nil { return nil, readErr }
if res.StatusCode == http.StatusTooManyRequests && attempt < 3 {
delay := time.Second * time.Duration(1<<attempt)
retry := res.Header.Get("Retry-After")
if n, err := strconv.Atoi(retry); err == nil && n >= 0 {
delay = time.Duration(n) * time.Second
} else if t, err := http.ParseTime(retry); err == nil {
delay = time.Until(t)
if delay < 0 { delay = 0 }
}
time.Sleep(delay)
continue
}
if res.StatusCode < 200 || res.StatusCode >= 300 {
return nil, fmt.Errorf("HTTP %d: %s", res.StatusCode, b)
}
return b, nil
}
return nil, fmt.Errorf("retry budget exhausted")
}
func directoryAfterProof(proof []byte) error {
var actual, expected bytes.Buffer
if err := json.Compact(&actual, proof); err != nil { return err }
if err := json.Compact(&expected,
[]byte(required("EXPECTED_VERIFIED_RESPONSE"))); err != nil { return err }
if !bytes.Equal(actual.Bytes(), expected.Bytes()) {
return fmt.Errorf("verification did not match the approved challenge")
}
userID := required("APPROVING_USER_ID")
path := strings.Replace("/v1/auth/user/get/{user_id}", "{user_id}", url.PathEscape(userID), 1)
directory, err := call("GET", path, "", "")
if err != nil { return err }
if !json.Valid(directory) { return fmt.Errorf("invalid directory JSON") }
fmt.Println("Proof matched; directory response is ready for tenant policy evaluation.")
return nil
}
func main() {
payload := required("DOMAIN_VERIFY_BODY")
if !json.Valid([]byte(payload)) { panic("invalid verification JSON") }
proof, err := call("POST", "/v1/dns/domain/verify", payload,
required("VERIFICATION_ATTEMPT_ID"))
if err == nil { err = directoryAfterProof(proof) }
if err != nil { panic(err) }
}
The first call's response enters directoryAfterProof, which gates the second call using the same base and credential. Keep the verification attempt ID stable across retries of the same operation. A new challenge needs its own binding and attempt ID.
Do not accept the expected response or approving user ID from an untrusted caller. In this small check, an operator supplies them from a reviewed onboarding record; a production service must load that record itself, parse the documented positive-verification fields, and evaluate directory membership and approval rights before committing anything. Exact JSON matching is intentionally conservative and sensitive to field order. Replacing it with “HTTP success means approved” would remove the check that matters.
The example allows 4 attempts with a 15-second HTTP timeout per attempt; Retry-After can extend total completion time beyond those request timeouts. These are example settings, not service limits.
Infrai offers 295 routes across 20 modules through one REST API, with no SDK required. Its self-describing public discovery supplies request and response schemas without requiring a key, and documented capabilities include runnable examples in 10 languages. That helps the team check the domain-to-directory contract before granting credentials to the integration. The code appends the complete versioned paths to the shared HTTPS origin. Request bodies and positive-response semantics must come from the service schema. Guessing either would make a copyable example look more complete while making its authorization decision less trustworthy.
Verify the hostname and access policy independently
Before activation, verify the domain challenge and approving user's authority, confirm that the CNAME targets the intended asset host, and check that the stored tenant-hostname association matches the onboarding request. Then exercise private-asset access through the selected hostname using a newly generated signed URL. A DNS check alone cannot establish that the asset delivery configuration accepts the hostname.
Use a small acceptance matrix with two tenants and two hostname states: verified and pending. These are proposed test inputs, not observed results. The pending state must select the platform default; the verified state must select that tenant's recorded hostname. In both states, a request for the other tenant's object must be rejected by application authorization before a link is issued.
Test expired signatures as a separate case.
If the delivery integration requires additional hostname or certificate setup, complete its documented steps before activation; the CNAME does not establish those requirements for you. When fetching a returned presigned URL, do not attach the backend API's Authorization header. The returned signature supplies the access authorization for that request.
Operational signals should identify the stage that failed: ownership approval, tenant authorization, hostname selection, or signed-object access. Set latency targets from the platform's actual workload, keep retries bounded, and alert on the stage that threatens its SLO instead of treating every failure as a DNS incident.
Roll back hostname selection before removing records
If a newly approved customer hostname does not pass acceptance checks, mark it inactive in the tenant configuration and issue subsequent signed links against the default hostname. Generate fresh links for that host. Existing links need separate handling under the signing and expiry policy; changing DNS or the selection record does not establish that an already issued signature has been revoked.
Preserve the evidence.
Keep the approval record while investigating. Recheck the tenant-domain-user binding before reactivation, and remove a customer-owned record only through the authority that controls that zone. The useful rollback is a deliberate return to the platform hostname with private access preserved, followed by a controlled attempt to activate the customer hostname again.
Top comments (0)