I Broke My Website Trying to Optimize It with Cloudflare R2
I wasn’t experimenting on a side project. I wasn’t doing anything reckless, but I ended up taking my website completely offline.
I Broke My Website Trying to Optimize It with Cloudflare R2

R2 on subdomain
I wasn’t experimenting on a side project. I wasn’t doing anything reckless.
I was doing something completely reasonable: trying to optimise my website.
Move static assets to Cloudflare R2. Reduce origin load.
Lower costs. Better caching. Faster site.
Instead, I managed to take my entire root domain offline.
This is the story of how that happened — not because Cloudflare R2 is broken, but because of a subtle assumption the UI quietly nudges you into making.
Everything Was Fine (Until It Wasn’t)
My setup before R2 was boring and stable — exactly how DNS should be:
example.com → A record → origin server
www.example.com → A record → origin server
services.example.com → A record → origin server
Both example.com and www.example.com worked perfectly.
Then I decided to “optimise”.
Enter Cloudflare R2
Cloudflare R2 has a “static website” feature.
The setup flow is simple:
- Create a bucket
- Enable static website hosting
- Add a custom domain
That last step is where everything went wrong.
The Assumption I Didn’t Realise I Was Making
When Cloudflare asks you to add a custom domain, the UI strongly implies — without explicitly saying it — that this means your root domain.
So I entered:
example.com
At no point did I realise:
You can (and should) enter a subdomain instead.
That misunderstanding is what broke my site.
The Symptom: NXDOMAIN
Almost immediately:
www.example.com→ worksservices.example.com→ worksexample.com→ DNS_PROBE_FINISHED_NXDOMAIN
Not a server error. Not a TLS issue. The domain simply stopped resolving.
Which is one of the worst failure modes you can hit.
Why This Happened
When you attach Cloudflare R2 static website hosting to the zone apex, Cloudflare temporarily removes the apex from normal DNS resolution and hands it over to the R2 service.
That’s not inherently wrong — but it has consequences:
- You can’t serve your existing site from the apex at the same time
- Existing
A @records effectively stop working - The apex may return
NXDOMAINwhile Cloudflare’s internal configuration rolls out
At this point, I still didn’t realise the real mistake.
The Actual Fix (And the Real Lesson)
The fix was much simpler than I initially thought — once I understood the model correctly.
Cloudflare R2 does not need the apex
R2 static websites work perfectly on a subdomain, for example:
static.example.com
Once I:
- Removed R2 from the root domain
- Re-added it using a subdomain (
static.example.com) - Restored the normal
Arecord at the apex - Waited for Cloudflare’s configuration to fully roll out
…the problem disappeared.
No redirect required. No special DNS tricks. No permanent architectural compromise.
The site simply came back.
The Part That Took Time to Click
Even after fixing the configuration, the apex didn’t recover instantly.
Cloudflare’s UI updates faster than its internal control plane.
So for a short period:
- The configuration looked correct
- DNS still returned
NXDOMAIN - Nothing appeared to make sense
Once Cloudflare finished rolling out the change globally, the apex resolved normally again.
This delay is what made the problem feel much more mysterious than it really was.
What I Originally Got Wrong
I didn’t know I could enter a subdomain as the custom domain, and the UI didn’t make that obvious.
If I had known that from the start, I would never have touched the apex — and my site would never have gone down.
Takeaways (Learn From My Mistake)
If you’re adding Cloudflare R2 to an existing site:
- You do not need to use the root domain
- Prefer a subdomain like
static,assets, orcdn - Be aware that attaching R2 to the apex will disrupt existing DNS
- After changes, allow time for Cloudflare’s configuration to fully propagate
- Redirects are optional — not a fix for broken DNS
Cloudflare R2 itself wasn’t the problem.
A misleading mental model — reinforced by the UI — was.
This happened on a real production site. If you’re curious, you can find it here: https://letsprintt.com
메타데이터
- post_id
- 74643f355bd6
- slug
- i-broke-my-website-trying-to-optimize-it-with-cloudflare-r2-74643f355bd6
- url
- https://medium.com/@chimanwadike/i-broke-my-website-trying-to-optimize-it-with-cloudflare-r2-74643f355bd6
- canonical_url
- https://medium.com/@chimanwadike/i-broke-my-website-trying-to-optimize-it-with-cloudflare-r2-74643f355bd6
- author_url
- https://medium.com/@chimanwadike
- status
- ok
- fetched_at
- 2026-07-13 06:23:13