Cloudflare workers with Custom Hostnames

I have several custom hostnames set up within my Cloudflare account however I am unable to set a wildcard * route to match all custom hostnames. Frankly, I can’t get the worker to run on any custom hostname apart from the main account’s domain.

Is anyone able to assist?

Are the hostnames in the routes you are trying to use :grey: or :orange:?

Its custom hostnames from Cloudflare for SaaS new product/feature.

Any custom hostname that cnames to runs on our Cloudflare account. So the external domains do not need to have a Cloudflare account or use Cloudflare name servers at all.

Here’s a demo domain we are testing with. (runs on Cloudflare but doesn’t use cloudflare nameservers or have a cloudflare account)

I’m having a similar issue with Page Rules. I believe I tried the same with Workers, but the new product doesn’t seem to allow Custom Hostname in certain features.

I have a ticket in because someone on staff says it’s supposed to work on the new SaaS product.

That would certainly limit external domains. But, I did try :orange: proxying my test site’s CNAME to the SaaS zone hostname, and I still get the error that the hostname needs to be part of the parent zone’s domain.

I have the exact same issues:
I can’t do any of the following for a custom hostname

  • Page rule
  • Workers
  • Purge cache

I have the exact same issues

I didn’t reply back here, but Support says that’s something they’re working on and should be ready hopefully by the end of this month.

It appears to be working with Workers now - but not pages. I wrote a Worker script that does the job, hopefully they create a better solution for this though.

addEventListener('fetch', (event) => {
	const request = event.request;
    const headers = request.headers;
    const host = headers.get('Host');
	var url = new URL(request.url);
    if (host == 'YOUR_CUSTOM_HOSTNAME') { = '';
    // you can add more rules here if you want to point multiple hostnames to the same worker
	event.respondWith(fetch(url, request));