How to properly set up a custom hostname with a worker?

I’m building a SaaS app with a Cloudflare Worker and would like my customers to be able to point their domains to the worker via a CNAME record. Steps taken so far:

  1. Launched a worker and assigned the route to it on Cloudflare
  2. Added as a fallback origin under SSL/TLS / Custom Hostnames on Cloudflare
  3. Added a worker AAAA 100:: proxied record under DNS on Cloudflare
  4. Added a custom hostname via the API on Cloudflare. Both the SSL/TLS certificate status and the Hostname status are currently Active.
  5. Added a @ CNAME record for on a respective third-party domain service.

The request to results in Error 522. However, the request to results in the worker serving the expected content.

I have followed these guides:

Yet, to no avail. I’m in dire need of help.


Can you please share here the syntax you used for the Worker route?
Did you use wildcards as mentioned in the documentation?


I tried both and **. Neither of them worked. The dashboard won’t let me specify */* as the route and says that is is invalid and should contain

This indeed should work.
Could you please open a support ticket and let us know the ticket number here?
We’ll investigate further then.
Please provide all details in the ticket, with the real hostnames.

I have opened a support ticket #2311247, but it got closed automatically because I’m on a free tier, even though I subscribed to paid custom hostnames.

Please, reopen the ticket and investigate it or tell me if I need to subscribe to a Pro plan to be able to access support. However, paying $20 for the sole purpose of submitting a support ticket for something that does not work as described in the docs seems unfair.

Currently this issue is a blocker, as the rest of the MVP is ready to be deployed to production any time soon. At this point I’m either hoping to get this solved or will be forced to switch to AWS CloudFront or I, however, would rather prefer to stick with Cloudflare as I genuinely favour it over everyone else.

Hi @c2u5hed,

That’s not necessary. The community can escalate issues such as this to support, and Nic is already looking at this one for you.

Thank you, guys. I sincerely hope that you will help me resolve this.

We have received word that the issue described here should be fixed.

SaaS hostname with Workers as origin should work.

Are you able to confirm this, @c2u5hed? :slight_smile:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.