Is there a limit on the number of custom domains that can be assigned to a worker?

Because custom domains connected to Cloudflare Workers cannot use wildcards, I’m looking for other options.

I have a wildcard setup in my Cloudflare DNS like:
CNAME * xxxx . xxxxx . workers . dev

I have potentially thousands of custom accounts that all need their own subdomain like:
customer1 . domain . com
customer2 . domain . com

Each of these needs to point to the same worker.

If I add these custom domains programmatically via the Cloudflare API… at what point is it going to error out and say “too many custom domains”?

The Custom Domain limit I believe is 100 per domain/zone (but if you’re on Enterprise, I’d bet it could be raised), and there is a documented limit of 1,000 worker routes per zone.

Why can’t you use worker/http routes then? You can set up a wildcard DNS Record AAAA *.domain.com 100:: Proxied and then a wildcard worker route like *.domain.com/*. You can do that on deeper subdomain as well, as long as you buy Adv. Certificate Manager (ACM) and issue a wildcard certificate.

If this is supposed to be on their domains, you can use CF for SaaS with a worker as well: Workers as your fallback origin · Cloudflare for Platforms docs

1 Like

Thank you, I wasn’t aware that worker routes had this capability (I thought these were only for URL sub-paths)

1 Like