Cross-account Worker Custom Domain
I've migrated from Pages to Workers + Assets but one thing I cannot get working is cross-account custom domains.
I have a worker with 2 envs (so effectively 2 workers) on account A but I want to use a custom domain in one of the envs in a Zone that belongs to account B. Any idea how to get this working?
I was able to do this in Pages using custom domains + setting up the CNAME myself in the zone of the other account
7 Replies
this should work
the custom domains I'm talking about are https://developers.cloudflare.com/workers/configuration/routing/custom-domains/. I'm not using CF for SaaS/Platforms
Those don't support external custom domains. You'd have to use CF For SaaS like above
Under the hood Pages itself used CF For SaaS for you. Workers just don't do the same for you automagically, they should eventually in order to support feature parity/convergence but not yet
that's a bummer
I've also thought about deploying the "staging" environment worker to Account B and keep the "production" env worker on the same account - could they be mixed?
I couldn't find references to accounts in https://developers.cloudflare.com/workers/wrangler/environments/
Wrangler Environments don't exist remotely, they're entirely a local concept managed by wrangler. By default, wrangler just appends the non-prod env name to the worker name to deploy them
As long as they let you switch out the accountId, I don't see why not, not something I've tested before, but seems plausible
how would Custom Hostname is CF for SaaS work?
Custom Hostname in Account A and then in the zone in Account B I create a cname to the cname target of the cust hostname?