Using a Worker as your origin
If you are building your application on Cloudflare Workers, you can use a Worker as the origin for your SaaS zone (also known as your fallback origin).
In your SaaS zone, create and set a fallback origin, but use a “fake” proxied DNS record.
- Example:
service.example.com AAAA 100::
- Example:
In that same zone, navigate to Workers Routes.
Click Add route.
Decide whether you want traffic bound for your SaaS zone (
example.com
) to go to that Worker:If yes, set the following values:
- Route:
*/*
(routes everything — including custom hostnames — to the Worker). - Worker: Select the Worker used for your SaaS application.
- Route:
If no, set the following values:
- Route:
*.<zonename>.com/*
(only routes custom hostname traffic to the Worker) - Worker: None
- Route:
Click Save.