Rihan Alkamim
PT EN

Automatically translated from Portuguese. Read the original.

I migrated DNS from GoDaddy to Cloudflare and the site timed out only on my computer

· 3 min read · DNS, Cloudflare, GoDaddy, Troubleshooting

Problem: after publishing my site on Cloudflare Workers and changing the domain nameservers, my cell phone opened the new site, but my computer gave ERR_CONNECTION_TIMED_OUT.

Solution: I proved it was not a block by comparing the responses from several resolvers DNS and I cleared the cache of NS and A records in the outdated resolver.

Result: site is up and running on all devices, without changing any configuration of the Cloudflare.

Context

The domain was registered with GoDaddy and pointed to a page "coming soon" from their site builder, with two A records:

rihanalkamim.com.  A  13.248.243.5
rihanalkamim.com.  A  76.223.105.230

I published the new site as a Worker with static assets and asked Cloudflare to enable the domain with the Custom Domains feature. The first attempt failed:

Hostname 'rihanalkamim.com' already has externally managed DNS records (A, CNAME, etc).
Delete them first or try a different hostname. [code: 100117]

It makes sense: with Custom Domain, it is Cloudflare itself that responds, without an origin server. The same name cannot point to an external IP and to the Worker at the same time. I deleted the two A records, published again and Cloudflare created the Worker records on its own.

The symptom

On my cell phone, the new site opened. On my computer, timeout. The first suspicion was some block by the WAF or by the Bot Fight Mode of the Cloudflare.

Diagnosis

First, I tested the connection directly to an IP of Cloudflare, bypassing the DNS:

curl -s -o /dev/null -w "%{http_code}\n" --resolve rihanalkamim.com:443:104.21.37.189 https://rihanalkamim.com/
# 200

200 response: Cloudflare was not blocking anything. The problem was on the path to it, i.e., in the DNS. Then I compared what each resolver responded:

nslookup rihanalkamim.com jerry.ns.cloudflare.com   # servidor autoritativo
nslookup rihanalkamim.com 1.1.1.1                   # resolvedor da Cloudflare
nslookup rihanalkamim.com 8.8.8.8                   # resolvedor do Google
Who responded Response
Authoritative (jerry.ns.cloudflare.com) 104.21.37.189, 172.67.212.107 (correct)
Google 8.8.8.8 IPs of Cloudflare (correct)
Cloudflare 1.1.1.1 13.248.243.5, 76.223.105.230 (old IPs of GoDaddy)

My computer used 1.1.1.1 as the primary DNS. To rule out DNS interception by the provider, I repeated the query over DNS over HTTPS, which is encrypted:

curl -s -H "accept: application/dns-json" "https://1.1.1.1/dns-query?name=rihanalkamim.com&type=A"

The answer came back the same, with the old IPs. It was not the provider: it was 1.1.1.1 itself. The detail that misled us: hours later, the TTL of the A record had gone up from about 2,200 to 3,200 seconds, instead of reaching zero. This only happens when the resolver looks up the answer again. And it was looking in the wrong place: it still had the old delegation in cache, pointing to GoDaddy nameservers, which continued to respond with the old IPs.

nslookup -type=NS rihanalkamim.com a.gtld-servers.net   # registro do .com: já mostra os nameservers da Cloudflare

NS records of .com domains usually have TTL of up to 48 hours, so waiting for the A record to expire did not solve the problem. Since the old page no longer responded on those IPs, the browser would wait until the timeout. The cell phone used another resolver, which was already updated.

Solution

Two options: wait for the TTL of the nameservers to expire (up to 48 hours) or clear the caches manually.

  1. Clear the cache of 1.1.1.1 in https://one.one.one.one/purge-cache/, first the NS record and then the A record, for the domain and for the www.
  2. Clear the Windows cache:
ipconfig /flushdns
  1. Reopen the browser, which also stores DNS in cache.

Lessons

  • Timeout after DNS migration is almost always cache, not blockage. Test the origin with curl --resolve before changing security rules.
  • Always compare the authoritative server with public resolvers. If the authoritative server is correct, the rest is a matter of time.
  • If the TTL of an old answer increases instead of decreasing, the resolver is looking up again from an old source: check the delegation (NS), not just the A record.
  • Deleting the old zone at the previous provider (or zeroing out its records) after the switch prevents resolvers with old cache from continuing to receive old answers.
  • Before a nameserver switch, it is a good idea to reduce the TTL of the records a few days in advance, so the transition is quick.

← All posts