Stuck with Custom Domain Support After Migrating from Pages to Workers
Hey everyone!
I've recently migrated my React app (Vite, React Router v7, SSR) from Cloudflare Pages to Cloudflare Workers. The app is multi-tenant and supports custom domains.
My dynamic subdomain setup (via a proxy worker) is still working great. However, I overlooked an important detail in the Workers vs Pages migration guide: Cloudflare Workers do not support custom domains that are outside of Cloudflare-managed zones. Unfortunately, this is a key requirement for our platform since we aim to make domain configuration as easy as possible for users.
Example use case:
The Worker is deployed at creator.x.dev, and I want it to also serve requests from www.userdomain.com (or its apex domain).
What I’ve tried so far:
❌ Adding userdomain.com as a custom domain for the Worker → Doesn’t work ("not in zone" error), as expected from the docs.
❌ Adding a CNAME from www.userdomain.com to creator.x.dev without proxying → Doesn’t work, as also documented.
❌ Enabled Cloudflare for SaaS, added creator.x.dev as the fallback origin, and configured www.userdomain.com as a custom domain under SSL/TLS > Custom Hostnames. The domain was verified and an SSL cert was issued — but I still get a 522 error when accessing the site.
My question:
Am I missing something here? Is there a workaround or any other approach to make this work? Or is this a fundamental limitation that would require me to re-architect the app or even migrate away from Cloudflare?
Thanks in advance for any help or ideas!
1 Reply
Not sure, but have you looked into https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/ ?