Add custom domain to workers without register or transfer domain to Cloudflare
As the title saying, my customers own a domain example.com, they won't allow to transfer nameserver to cloudflare just to host a website. It is weird that Cloudlfare Pages allow to custom domain by CNAME but Workers doesn't. Also find some thread saying about it but there are no clear answer yet: https://www.reddit.com/r/CloudFlare/comments/1mmlnku/dear_cloudflare_if_you_want_me_to_ditch_pages_for/
Reddit
From the CloudFlare community on Reddit
Explore this post and more from the CloudFlare community
5 Replies
Do you(not your customer) have a domain on Cloudflare already?
No I don't
If you do, what you can do is deploy the Worker to
*/*(I think this is the right pattern) on your zone, and then use Cloudflare for SaaS to allow others to CNAME to your domain
It's not quite as easy, but will also raise the feedback for making it easier on Workers without SaaSThere's a guide for Workers here: https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/start/advanced-settings/worker-as-origin/
and then generic enabling: https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/start/getting-started/
(only works on subdomains or on root/apex domains if the provider supports flattening cnames/anames/whatever they call them)
*/* is right but be careful, it'll swallow all the other traffic for your domain. You can use another pattern like *.<zonename>.com/*, service: none to exclude, but I would really recommend just using a dedicated zone/domain for this and your customers, they go through all your rules/firewall/etc on the domain/zone as well, which gets quickly complex if you're combining your main website + customer setups
You'll also need to enable CF For SaaS before it lets you add that route iircHello! Just going through some old messages. We're actively working on a project which hopefully will improve the experience here for running a Worker on a custom domain with external nameservers (a domain which hasn't been onboarded on to Cloudflare). Don't have a hard ETA yet, but I think you can expect updates here in the coming months 🙂