Publish a tenant's vanity CNAME only when its target matches the intended asset host; issue signed URLs for that tenant's verified hostname, and use the default hostname until verification succeeds. Keep routing and authorization separate. A successful DNS change is not evidence that a private course file is protected.
TL;DR: Store the hostname per tenant, reconcile intended records against published records, and generate signed links against the selected hostname. Keep objects private or signed-only. Treat the switch as a reversible configuration change with separate checks for routing and access.
For an edtech company pointing company mail at a provider through MX records, this distinction matters beyond mail. The same DNS change process may also carry a school's branded courseware hostname. Review those as separate intents: the mail provider supplies the desired MX configuration; the asset configuration supplies the desired CNAME target. An MX review cannot certify an asset cutover.
Freeze the intent.
The operational question is which records actually match that intent when a URL is issued. A queued reconciliation job can run again, and a completion message can arrive after the operator has changed the desired hostname. The runbook should compare the current desired configuration, apply the same intended change safely, and verify the result before selecting the vanity hostname. These are design requirements, not reports of a production incident.
1. How should a tenant verify its vanity asset hostname and CNAME?
Start with a small change manifest. Keep a tenant identifier, its stored vanity hostname, the intended asset host, the default asset hostname, and the verification decision together. Keep the mail provider's requested MX configuration in a separate entry. The manifest describes intent; a DNS record listing supplies another piece of evidence. Don't silently treat them as interchangeable.
Consider an illustrative tenant called North School. Its asset hostname is assets.north.example, and its intended CNAME target is assets.platform.example. These are example names, not production endpoints. Its company mail change belongs to the MX entry, using the actual provider's instructions rather than invented mail targets.
There are 3 distinct checks here: does the stored hostname belong to this tenant's configuration, does the CNAME match the intended asset host, and has the vanity record been verified? A passing first check does not imply either of the others. Keep the evidence attached to the configuration being approved, particularly if the hostname changes while verification work is queued.
The common trap is a green update response followed by an immediate hostname switch. That response describes the write operation. The runbook still needs evidence that the published record matches the desired configuration.
For mail, compare the provider's requested MX configuration against the published records independently. DMARC is useful email context, but a DMARC reference is not a source for a provider's MX values or an asset delivery configuration.
2. Reconcile the CNAME without coupling it to access
Upsert the customer's CNAME to the intended asset host. Make the reconciliation job repeatable: receiving the same desired configuration twice should converge on the same record rather than accumulate changes. Store enough application state to distinguish a retry of the same intent from a new cutover request.
That distinction is the idempotency boundary.
Suppose a worker sees the North School change twice. Before each application, it should compare its work item with the current desired configuration. If the operator has already selected a different target, an old retry should not restore the previous intent. An idempotency key can help deduplicate a repeated write, but it cannot decide which desired configuration is current. That decision belongs to the application.
Keep a previous known configuration available for rollback. There is a trade-off: storing explicit change state takes more effort than issuing a DNS write from a request handler, but it gives an operator a concrete answer to what the next retry is allowed to apply. For a queue-driven runbook, that answer matters more than a short handler.
The record controls routing. The signature controls access. Don't let CNAME reconciliation change the object's private or signed-only policy, and don't mark a tenant ready merely because an object can be reached through some hostname.
3. Select the tenant hostname before generating the signed link
Read the tenant's stored vanity hostname and its verification decision. Select the vanity hostname only when the record is verified for the intended configuration; otherwise select the default hostname. Generate the signed URL against that selected hostname.
Avoid guessing from a tenant's display name.
Before implementing the write adapter, inspect the service's discovery response for the DNS upsert and storage presigning capabilities. This runnable Go example retrieves that contract without guessing request fields. Save it as main.go; set INFRAI_BASE_URL to the service's versioned API base and INFRAI_API_KEY to your backend key, then run it with Go. Discovery itself is public and needs no key; this example accepts the same environment-based authentication used by the eventual backend adapter. It performs a read, not a DNS write or an asset download.
package main import ( "fmt" "io" "net/http" "net/url" "os" "strconv" "strings" "time" ) func main() { if err := inspect(); err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(1) } } func inspect() error { base := strings.TrimRight(os.Getenv("INFRAI_BASE_URL"), "/") u, err := url.Parse(base) if err != nil || u.Scheme != "https" || u.Host == "" || u.Path != "/v1" || u.RawQuery != "" || u.Fragment != "" { return fmt.Errorf("set INFRAI_BASE_URL to the versioned HTTPS API base") } client := &http.Client{ Timeout: 15 * time.Second, CheckRedirect: func(_ *http.Request, _ []*http.Request) error { return http.ErrUseLastResponse }, } for attempt := 0; attempt < 4; attempt++ { req, err := http.NewRequest(http.MethodGet, base+"/discovery", nil) if err != nil { return err } if key := os.Getenv("INFRAI_API_KEY"); key != "" { req.Header.Set("Authorization", "Bearer "+key) } resp, err := client.Do(req) if err != nil { return err } body, readErr := io.ReadAll(resp.Body) resp.Body.Close() if readErr != nil { return readErr } if resp.StatusCode == http.StatusTooManyRequests && attempt < 3 { pause := time.Second * time.Duration(1<<attempt) retry := resp.Header.Get("Retry-After") if seconds, err := strconv.Atoi(retry); err == nil && seconds >= 0 { if requested := time.Duration(seconds) * time.Second; requested > pause { pause = requested } } else if until, err := http.ParseTime(retry); err == nil { if requested := time.Until(until); requested > pause { pause = requested } } time.Sleep(pause) continue } if resp.StatusCode < 200 || resp.StatusCode >= 300 { return fmt.Errorf("discovery status %d: %s", resp.StatusCode, body) } fmt.Println(string(body)) return nil } return fmt.Errorf("discovery retry limit reached") } Use the returned discovery path field for subsequent requests. Inspect the relevant capability's full request schema before implementing a write, and keep the verification decision in application state. A production adapter also needs to represent DNS names consistently before comparison.
Presigning requires the bucket and key as path segments, with the operation in the body. Keep those inputs distinct from hostname selection. The selected signing service's request contract must establish how its signing flow uses the intended hostname; don't guess an undocumented hostname field. A Node.js implementation needs this same separation, even though this example uses Go to make the runbook's decision explicit.
Sign for the selected host from the start. Editing a returned URL's hostname is not evidence that the edited link preserves the intended access behavior. Verify the actual link the application will hand to the student. Keep object access private or signed-only, and never forward a backend API Authorization header to a returned presigned URL.
4. Compare control surfaces by the drift evidence they expose
Choose the control surface that fits the team responsible for reconciliation. Evaluate the DNS write, record inspection, and signing flow separately; a familiar DNS console does not settle the private-asset workflow.
Infrai offers one key and one bill, a unified REST API with no SDK required, and public self-describing discovery. Sharing credentials across the DNS worker and storage integration avoids separate invoices to reconcile. Plain HTTP lets the Go reconciliation worker and Node.js signing integration use standard HTTP clients instead of separate vendor SDKs. The platform covers 295 routes across 20 modules with a consistent interface; breadth is useful here because record management and private storage belong to the same operational change.
Discovery exposes full request JSON Schema and response schemas without requiring a key. Runnable examples cover 10 languages, including Go and JavaScript; the person reviewing DNS intent and the person integrating the Node.js link generator can inspect the same contract before implementation. That reduces schema-translation friction across this workflow. It does not prove that a tenant's CNAME is correct.
| Option | When to evaluate it | Boundary to verify before selecting it |
|---|---|---|
| Amazon Route 53 | The team wants to manage this change in its AWS DNS workflow. | Establish how record inspection feeds tenant verification; validate asset signing separately. |
| Cloudflare DNS | The team wants to manage the school's records in its Cloudflare DNS workflow. | Compare intended and published CNAME values; do not infer signing behavior from DNS management. |
| Google Cloud DNS | The team wants reconciliation in its Google Cloud DNS workflow. | Demonstrate repeatable writes and inspection, with a separate decision for private asset links. |
| Consolidated backend API | The team wants to consolidate backend credentials and billing for the combined workflow. | The service covers 295 routes across 20 modules. Inspect the public discovery schemas before connecting reconciliation to presigning. |
The first 3 are concrete DNS options, not interchangeable promises about asset authorization. Their linked documentation gives reviewers a starting point for checking the chosen control surface. Keeping the existing DNS workflow avoids introducing another control surface just for this change; consolidation instead fits a team that wants DNS and storage integrations behind one backend interface. Tenant intent and hostname selection remain application responsibilities in either case.
The comparison has a limit: it establishes selection criteria, not a tested feature-parity ranking. Use a small acceptance exercise to decide. Ask each candidate implementation to apply the desired CNAME, repeat the same work, inspect the record, and keep the default hostname selected until verification passes. Then evaluate signed-link behavior. No latency, uptime, or savings measurement is implied by that exercise.
5. Verify the student link and rehearse rollback
Verification has to cover the application output. For North School, inspect the intended and published CNAME, confirm which hostname the application selected, and exercise the resulting signed link for a private course asset. Also exercise the unverified state: it should select the default hostname. Test an unsigned request against the same private-access expectation.
Keep the results separate.
A correct hostname with incorrect access behavior is a failed acceptance check. So is a correctly signed link issued for another tenant's hostname. Record what was checked and which desired configuration the evidence belongs to. A delayed verification result must not approve a newer change merely because both work items name North School. For the company mail change, maintain a separate comparison of the provider's requested MX configuration and the published MX records; passing the student-link check cannot close the mail change.
If the vanity check fails, select the default hostname for new signed links. Restore the previous intended CNAME configuration if the cutover itself must be reversed, then inspect the published record again. Don't describe selecting the default hostname as revoking links already issued; rollback of hostname selection and access control are separate decisions.
Close the change only when intent, published records, and generated links agree. Until then, keep the default selected.
References
- Amazon Route 53 Developer Guide: https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/Welcome.html
- Cloudflare DNS documentation: https://developers.cloudflare.com/dns/
- Google Cloud DNS documentation: https://cloud.google.com/dns/docs
- RFC 7489, Domain-based Message Authentication, Reporting, and Conformance: https://datatracker.ietf.org/doc/html/rfc7489