Custom domains explained: DNS records, and connecting one to your app
What A, CNAME, TXT, MX and the other DNS records do, why the bare domain is the tricky one, and the exact steps to point a domain you own at a hosted app without breaking your email.
Key Takeaways
- Three parties are involved. The registrar sells you the name, the DNS provider answers lookups for it (often the same company), and your host serves the app. Connecting a domain means telling the DNS provider where the host is.
- Subdomains use CNAME; the bare domain usually uses A. A rule in the DNS standards says a CNAME can’t share a name with other records, and the bare domain always has other records. That is why hosts give you an IP address for example.com and a hostname for www.example.com or app.example.com.
- TTL controls how long mistakes linger. Every record has a time to live in seconds. Lower it a day before a planned change so a fix takes minutes to reach everyone, not hours.
- Changing nameservers moves all your records. If you switch the whole domain to a new DNS provider, copy the MX and TXT records first or your email stops arriving. Changing only the website’s A or CNAME record leaves email alone.
- Check with a lookup tool, not your browser. Browsers and operating systems cache answers. A command like dig shows you what DNS really says right now.
Quick-Start Prioritization Framework
| You want | Record to add | Typical value from your host |
|---|---|---|
| app.example.com or www.example.com to show your app | CNAME | A hostname, such as something.hostname-dns.com |
| example.com (no www) to show your app | A (and AAAA if given) | One or more IP addresses |
| Prove to a host or service that you own the domain | TXT | A random verification string |
| Email at you@example.com to keep working | MX (leave as is) | Your email provider’s mail servers |
| Only one certificate authority to issue certificates | CAA | That authority’s domain, e.g. letsencrypt.org |
Your app works on a long address like my-app-7f3a.someplatform.app, and you want it on yourname.com. Getting there means editing DNS, a settings screen full of record types, names and values that most people touch once a year and fear every time. The good news is that you only need about five record types, and the whole job comes down to three questions: who sells you the name, who answers lookups for it, and where the app actually runs. This guide explains each record in plain terms, walks through connecting a domain step by step with a worked example, and lists the mistakes that cause most “my domain isn’t working” afternoons.
What happens when someone types your domain
Before touching any settings, it helps to see the path a visitor’s request takes. A browser can’t connect to a name; it needs an IP address. DNS is the system that turns example.com into an address, and your records are the answers it gives.
Three roles are involved, and much of the confusion about domains comes from people mixing them up.
The registrar
The company you paid for the name: Namecheap, GoDaddy, Porkbun, Cloudflare Registrar, Squarespace Domains and many others. The registrar records that you own the name and which nameservers are in charge of it. You renew here each year.
When comparing registrars, look at the renewal price, not the first-year price. Some sell the first year cheaply and renew at a much higher rate. Cloudflare, for example, says its registrar charges only what the registry and ICANN charge, with no markup on registration or renewal.
The DNS provider
The servers that answer “what is the address for example.com?” They are named in the domain’s NS (nameserver) records. By default this is your registrar, but you can point the nameservers somewhere else, such as Cloudflare or your host, and manage records there instead.
This is where you will do almost all of the work. When a guide says “add a CNAME record”, it means here.
The host
The platform that runs your app and serves its pages. It needs two things from you: records that send traffic its way, and sometimes a TXT record proving you control the domain. In return, it issues an HTTPS certificate for the name once it sees traffic arriving correctly.
The DNS records you will actually touch
DNS has dozens of record types. For connecting an app and keeping email working, these are the ones that matter. The descriptions follow Cloudflare’s reference documentation, which is a clear plain-language source.
| Record | What it does | Example |
|---|---|---|
| A | Points a name to an IPv4 address | example.com → 192.0.2.10 |
| AAAA | Points a name to an IPv6 address | example.com → 2001:db8::10 |
| CNAME | Makes a name an alias of another hostname, which is then looked up | app.example.com → cname.yourhost.com |
| TXT | Holds text; used to prove ownership and for email authentication (SPF, DMARC) | _verify.example.com → "abc123" |
| MX | Tells other mail servers where to deliver email for the domain | example.com → mx1.mailprovider.com, priority 10 |
| CAA | Lists which certificate authorities may issue certificates for the domain | example.com → 0 issue "letsencrypt.org" |
| NS | Names the DNS servers in charge of the domain or a delegated subdomain | example.com → ns1.dnsprovider.com |
Names: @, www and subdomains
In most DNS dashboards the name field is relative to your domain. @ means the domain itself (example.com, also called the apex or root). www means www.example.com. app means app.example.com. Some providers want the full name instead; if a record doesn’t work, check which style the form expects.
The IP addresses in the example are placeholders
Always copy the exact values your host shows you for your project. Hosts change their addresses over time and some give each project its own CNAME target, so values copied from an old blog post or another project are a common cause of failure.
Why the bare domain is the awkward one
Hosts usually prefer a CNAME, because it lets them move your app between servers without asking you to update anything. But you will notice they ask for an A record for example.com and a CNAME only for subdomains. There is a standards reason for that.
The CNAME rule
RFC 1912, a long-standing guide to running DNS, states that a CNAME record is not allowed to coexist with any other data at the same name. The apex of every domain always has other records, at minimum NS and SOA records, and usually MX and TXT for email. So a plain CNAME at example.com breaks the rules, and on some DNS software it can make the whole domain unreachable.
The three workarounds
Use an A record. The host gives you one or more IP addresses for the apex. This is the most common instruction and works with every DNS provider.
Use a flattened CNAME, sometimes called ALIAS or ANAME. Some DNS providers let you enter a hostname at the apex and then answer lookups with the IP address behind it. Cloudflare calls this CNAME flattening, and it is what allows a bare domain to point at a Cloudflare Pages site.
Make www the main address. Point www.example.com at the host with a CNAME and redirect example.com to it. Vercel’s documentation recommends adding the www version when you add an apex domain for this reason.
Pick one main address and redirect the other
Whichever you choose, add both example.com and www.example.com to your host and set one to redirect to the other. Otherwise half your visitors get an error, depending on whether they typed www.
Step by step: connecting a domain to a hosted app
Here is the full sequence, using a worked example. Maya runs a booking app on a hosting platform at maya-bookings.hostapp.io. She owns mayastudio.com, registered at a typical registrar that also provides DNS. Her email runs on Google Workspace. She wants the app at book.mayastudio.com and her existing website to stay where it is.
1. Add the domain on the host first
In the host’s domain settings, Maya adds book.mayastudio.com. The host responds with the record it wants: a CNAME named book pointing at a hostname unique to her project. If the domain had been used on another account at the same host, it would also ask for a TXT record to prove ownership.
2. Lower the TTL if you are changing an existing record
Her subdomain is new, so there is nothing to lower. If she were moving the main website, she would first edit the existing record’s TTL down to something like 300 seconds and wait out the old TTL, so that any correction later spreads in five minutes.
3. Add the record at the DNS provider
In the registrar’s DNS screen she adds: type CNAME, name book, value the hostname the host gave her, TTL automatic or 300. She does not touch the MX records for Google Workspace or the A record for her existing site.
4. Check what DNS says, then wait for the certificate
From a terminal she runs dig book.mayastudio.com CNAME +short and sees the host’s hostname come back. (On Windows, nslookup -type=CNAME book.mayastudio.com does the same.) The host’s dashboard then shows the domain as verified and issues an HTTPS certificate, which usually takes from a few minutes to an hour.
5. Test the real thing
She opens https://book.mayastudio.com in a private window, on her phone over mobile data rather than Wi-Fi, and checks that sign-in still works. Login cookies and redirect URLs (for Google sign-in, for example) are often tied to the old address, so a working home page doesn’t prove a working app.
TTL and “propagation”, demystified
People say DNS changes take up to 48 hours to propagate. What actually happens is caching. Every DNS answer comes with a TTL, a number of seconds that resolvers around the internet are allowed to remember it. Until that time runs out, some visitors still get the old answer.
Lower it before a change, raise it after
RFC 1912 gives the classic advice: keep TTLs reasonably long for stable records, lower them before a planned major change, and wait for the old TTL to expire before relying on the new value. In practice: a day before you move a live site, set the record’s TTL to 300 seconds. Make the change. Once everything works, raise it again to an hour or more.
New records are usually fast
A brand-new subdomain has nothing cached, so it often works within minutes. The slow cases are changing a record that already had a long TTL, and changing nameservers, which are cached at the registry level and often have TTLs of a day or more.
How to see the truth
Use dig example.com A +short to see the current answer, and dig @8.8.8.8 example.com A +short to ask a specific public resolver. If the authoritative answer is right but your browser still shows the old site, the problem is a cache on your machine, not your records.
Don’t break your email while you’re in there
The most damaging domain mistake isn’t a broken website. It’s silently losing email for days because records were deleted or never copied.
Changing nameservers moves everything
Some hosts offer to manage your DNS for you by switching the domain’s nameservers. That moves every record to the new provider. Vercel’s documentation warns to copy your existing records first, including MX records for email and verification TXT records, and notes that changing only the website’s A or CNAME record doesn’t require moving anything else. If you only need the website connected, the record-by-record method is safer.
The email authentication records
Email providers depend on TXT records. SPF lists which servers may send mail for your domain, DKIM publishes a key used to sign messages, and DMARC tells receivers what to do when checks fail. Google’s sender guidelines require all senders to Gmail accounts to set up SPF or DKIM, and anyone sending more than 5,000 messages a day to use SPF, DKIM and DMARC.
If your app sends email (password resets, receipts), the email service will give you its own SPF and DKIM records to add. Note that a domain can only have one SPF record; add the new service to the existing one rather than creating a second.
Common mistakes
Most domain problems come from a small set of causes. Check these before contacting support.
Conflicting records for the same name
An old A record for www left in place next to a new CNAME for www. Delete or replace the old record; don’t add a second one beside it. Many registrars create default “parking” records that must be removed.
Typing the full name in a relative field
Entering book.mayastudio.com in a field that appends the domain produces book.mayastudio.com.mayastudio.com. If a lookup returns nothing, check how the record was saved.
Editing DNS at the wrong company
If your nameservers point at Cloudflare, records added at the registrar do nothing. Look up the NS records first (dig example.com NS +short) to see who is really in charge.
A CAA record that blocks your host’s certificate
If a CAA record allows only one certificate authority and your host uses another, the certificate never issues and the site shows a security warning. Either add the host’s authority to the CAA record or remove the restriction.
Proxying in front of the host without reading its docs
Turning on a DNS provider’s proxy (Cloudflare’s orange cloud, for example) puts another service between visitors and your host. Some hosts support this and some recommend DNS-only mode for verification and certificates. Start with DNS-only, confirm everything works, then add a proxy deliberately.
If you’d rather not do this yourself
If you’d rather not manage DNS at all, Floot’s paid plans include custom domains for apps you build and publish there, and the Pro and Power plans include one free domain, so the domain and the app sit in one place.
Frequently Asked Questions
How long does it take for a custom domain to work?
A new subdomain record often works within minutes. Changing an existing record can take as long as its old TTL, and changing nameservers can take a day or more because those answers are cached for longer. HTTPS certificates are usually issued within minutes to an hour after the records are correct.
Should I use www or the bare domain for my app?
Either works if you add both to your host and redirect one to the other. Using www as the main address lets you use a CNAME, which some hosts prefer because they can change their servers without you updating records.
Can I put my app on a subdomain and keep my existing website?
Yes. Add a CNAME for a name like app or book pointing at your app’s host, and leave the records for the main domain alone. This is the lowest-risk way to connect a domain.
Do I need to move my domain to my hosting company?
No. You can keep the domain at any registrar and only add the records your host asks for. Transferring the registration or switching nameservers is optional.
Why does my domain work on my computer but not my phone, or the reverse?
Different devices and networks cache DNS answers for different lengths of time. Check the authoritative answer with dig or an online DNS lookup tool. If it’s correct, wait out the TTL rather than changing records again.
Will connecting a domain to my app break my email?
Not if you only add or change the A or CNAME record for the website. Email depends on MX and TXT records, which break only if you delete them or switch nameservers without copying them over.
Sources
- Cloudflare, DNS record types, 2026 https://developers.cloudflare.com/dns/manage-dns-records/reference/dns-record-types/
- Cloudflare, CNAME flattening, 2026 https://developers.cloudflare.com/dns/cname-flattening/
- IETF, RFC 1912: Common DNS Operational and Configuration Errors, 1996 https://www.rfc-editor.org/rfc/rfc1912
- Vercel, Adding and configuring a custom domain, 2026 https://vercel.com/docs/domains/working-with-domains/add-a-domain
- Google, Email sender guidelines, 2026 https://support.google.com/a/answer/81126
- Cloudflare, Registrar overview, 2026 https://developers.cloudflare.com/registrar/