Is it possible to use a worker to enable multiple origins for custom domains (Cloudflare SaaS) without enterprise

I’ve never worked with Cloudflare workers before, and i’m wondering if a worker example is applicable in a case for Cloudflare for SaaS.

I do not have an enterprise account, but i wish to route traffic from certain SaaS custom domains to one origin and certain to another origin (during a move/upgrade). By default this is not possible since multiple fallback domains requires an enterprise account.

But the documentation states that i can use a worker as the origin. Could I then use a worker to route the traffic from one domain to the other origin without the client seeing it? Or is that outside the scope of a worker? Will this cause any noticable performance issues if possible?

I was looking at this example:

Kind

If anyone is interested it worked fine.

The Cloudflare for SaaS custom domains has a worker origin that acts as a reverse proxy and depending on requested host redirects to different origins. Since one of my origins were an azure app service i had to make sure to add the X-Forwarded-Host header so that the solution got it correctly.

Kind regards
Martin