Worker as a CNAME Host?

So i am trying to use a Worker as a CNAME Host. I managed to setup the worker and connect it to a custom domain and used that domain from the worker as a CNAME Host. It seems to have kinda worked but every time i try it on a domain that's pointed to the worker domain it returns a 522 error. Now i am wondering if it's even possible to do that with the Free Plan? If yes how could i fix that issue?
6 Replies
Chaika
Chaika2mo ago
Are you trying to set up custom domains to use your worker that are within your account, or that will be external customer domains?
The_Cookie
The_CookieOP2mo ago
For external customer domains.
Chaika
Chaika2mo ago
CF For SaaS is what you want: https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/ Issues SSL/TLS certs as well and just works. You get 100 free hostnames and then 10 cents per custom hostname per month over that There's a guide for setting up with workers here: https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/start/advanced-settings/worker-as-origin/. Because it requires a wildcard route & CF For SaaS inherits your zone security/settings I usually recommend people to use a separate domain for it to avoid accidentally breaking their main one or accidentally applying rules/configs to customers
The_Cookie
The_CookieOP2mo ago
Alright thanks!
Chaika
Chaika2mo ago
For your own domains within your account you can just add custom domains for them. Workers aren't typical servers or anything like that so they don't exist at an IP you can point to (they're just behind the CDN in general) and you can't CNAME across Cloudflare proxied domains normally unless the source is within the same account (plus would need tls/ssl), so not using CF For SaaS just doesn't work
The_Cookie
The_CookieOP2mo ago
I got one question: I have connected a domain to my worker. I tried to set it as a fallback origin but it says that the DNS records are not setup correctly. Never mind figured it out Thank you so much it worked!
Want results from more Discord servers?
Add your server