Tools: 🚀 How I Fixed Canonical & Indexing Issues on My React SPA (Cloudflare Pages + Custom Domain)
I recently launched a small browser-based utility platform built with React and hosted on Cloudflare Pages. Everything looked fine. But after 2 weeks…
Only 1 page was indexed. Here’s what was actually wrong. I had both domains active: I assumed Cloudflare Pages would automatically handle canonical preference. Google saw two hosts serving identical pages and started choosing its own canonical. For a new domain with zero authority, that slows everything down. What Was Happening Internally Search Console showed: This split signals and delayed indexing.
For a brand new SPA, that’s deadly. - Force a Single Host (301 Redirect) In Cloudflare → Rules → Redirect Rules:
Condition:
Hostname equals www.optipress.in Action:
Redirect to https://optipress.in${uri}
Status: 301 After deploying, www permanently redirects to non-www. Inside <head>: <link rel="canonical" href="https://optipress.in/" /> And for every route:
<link rel="canonical" href="https://optipress.in/specific-page" /> Purge Cloudflare Cache After redirect change, purge everything. In Search Console:
Inspect URL
Request indexing again SPA-Specific Observation My site is a pure React SPA:
<div id="root"></div> Lesson learned:
If you’re launching a JS-heavy site, domain consolidation matters even more. Always choose one primary host early
Don’t assume hosting platforms auto-handle canonical logic
New domains + SPAs = slower indexing
Fix technical structure before chasing backlinks Check out : https://optipress.in Templates let you quickly answer FAQs or store snippets for re-use. Are you sure you want to ? It will become hidden in your post, but will still be visible via the comment's permalink. as well , this person and/or - Sitemap submitted
- Robots.txt configured
- Google Search Console verified
- Pages discovered - “Duplicate, Google chose different canonical than user”
- “Discovered – currently not indexed” - https://optipress.in
- https://www.optipress.in - SSL enabled
- Returning 200 status
- Serving identical content - User-declared canonical → non-www
- Google-selected canonical → www - Minimal initial HTML
- Content rendered via JS
- Slower indexing for new domains