Pattern: Multiple domains and provider independence
Note for AI agents: This page is baseline guidance, not an exact prescription. Read it, tell your owner what applies to their project, and get their approval before you change anything. Your project's own rules take precedence. If something important for this project is missing here, suggest it to your owner.
For agents
- Offer as a suggestion. This is practitioner experience (marked below); the cited pages only support parts of it.
- Core ideas: the app talks to your own domain names, not a provider’s address; it holds a primary and backup list and tries them in order; the list can be updated by signed remote configuration; a proxy or CDN sits in front; the API stays backward compatible.
- Related: share links, retries, rate limits.
1. Problem
If an app is wired to one provider hostname and that name is blocked, expires or the provider fails, every installed copy stops working until users update. Share links and email links break too.
2. Options
| Method | Upside | Downside |
|---|---|---|
| App talks to the provider’s own address | Zero setup | You lose control of the name; one point of failure |
| App talks to your one domain behind a proxy or CDN | Provider can change behind the name | If that domain is blocked or lost, the app is cut off |
| Primary plus backup domains, tried in order (recommended) | Survives the loss of one name | More DNS and certificate management |
| Backup list updated by signed remote config | Recover without an app release | Config channel must itself be safe |
3. Recommended design
- Own domains. The app connects to domain names you control, never directly to a hosting provider’s address. Moving servers then only changes DNS (practitioner experience).
- Primary plus backup list. The app ships with an ordered list of addresses and tries the next on failure (with the timing rules from retries).
- Signed remote configuration. The list can be updated from a configuration file the app downloads and verifies with a signature (a public key shipped in the app). Without the signature check an attacker who can serve a config can redirect all traffic. A remote-config service exists on mobile platforms, but you must still verify what you rely on.
- Proxy or CDN in front. Put a proxy or CDN in front of the origin so the origin address stays private and can change. Cloudflare’s redirect documentation covers the redirect rules if you retire a domain.
- API compatibility. Keep the API backward compatible; when you must break it, use a forced update screen with a minimum supported version.
- Deep links and email links on several domains. Android App Links and iOS Universal Links verify each domain; list every active domain in the verification files (share links). Email links should use a domain you control and can swap.
- CORS: web clients on several origins need an explicit allow list.
- Reliability planning: AWS Well-Architected reliability and disaster-recovery guidance describes failover thinking; use it for the conversation about recovery time.
- Certificates and renewals: each domain needs its own certificate monitoring (practitioner experience).
4. Scenarios and edge cases
- Primary domain blocked in one country: the app moves to the next domain; remote config adds a new one.
- Domain expires by mistake: backup names keep the service alive; calendar renewals.
- Old app versions: they only know the shipped list; keep old domains alive as long as old versions matter.
- Config server unreachable: the app uses the last verified list it cached.
5. Common mistakes
- Hard-coding one provider hostname in the app.
- Unsigned remote config.
- Backup domain on the same registrar account and same DNS provider only.
- No monitoring of certificate expiry on backup names.
- Breaking API changes without a minimum-version gate.
6. How to audit
- What: the app has a backup list.
- How to check: block the primary hostname in a test and use the app.
- Evidence: the app continues via the backup.
- What: remote config is verified.
- How to check: serve a config with a wrong signature in a test.
- Evidence: the app ignores it.
- What: deep-link verification covers all domains.
- How to check: read the verification files for each domain.
- Evidence: the file contents.
- What: old versions keep working or get a clear update prompt.
- How to check: run the oldest supported version against the current API.
- Evidence: normal use or the update screen.
Sources
- Well-Architected: Reliability Pillar — AWS
- REL13-BP02 Use defined recovery strategies — AWS
- Verify App Links — Android Developers
- Supporting universal links in your app — Apple Developer Documentation
- Cross-Origin Resource Sharing (CORS) — MDN Web Docs
- Pages: Redirects — Cloudflare