Using Cloudflare SaaS custom domains

I have created a reverse proxy worker and have set up a custom domain for my zone. This is all working as expected. However I would like to use the custom hostnames feature so that my clients can utilize my reverse proxy with their domains. I tested it and my Fallback Origin status is active and my test custom hostname has both certificate and hostname status set to active as well. However when trying to load the reverse proxy I get the Cloudflare 522 connection timed out error. Why would this be happening?

Welcome to the Cloudflare Community!

There’s a specific way you have to setup your Worker Routes to make CF for SaaS/Custom Hostnames work with Workers:

You basically just need a wildcard route to match all traffic - including those from custom hostnames. Worker Routes doesn’t see the traffic as yourworkerfallbackoriginexample.com, it sees it as from your customer’s custom hostname. Just be careful to exclude other subdomains if you use that domain for other things, as per the guide.

1 Like

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