Invoke worker via multiple external sub-domains

Hi,

I’m trying to figure out the best way to have multiple external sub-domains bind or invoke a worker.

For example, these sub-domains (below) should all somehow invoke the same worker.

main.app.com (internal, I can add it to Cloudflare and them assign a worker)
my.client1.com (external, can’t add it to Cloudflare)
our.client2.com (external, can’t add it to Cloudflare)
us.client3.com (external, can’t add it to Cloudflare)

How can I map them all via DNS or HTTP redirection in the simplest way possible, so that they all can invoke the same worker? Ideally, I just want to have a worker script, and avoid any other code or configuration elsewhere.

Hope it makes sense. I’ll appreciate your suggestions for a solution or workaround.

Cheers :slight_smile:

How about forwarding requests for my.client1.com to WORKER.YOURSUB.workers.dev?

Thanks @sdayman.

Unfortunately, external sub-domains may or may not have HTTP redirection capability in their registrar/DNS control panel, so we can only work with standard DNS records like A or CNAME. I can have them point it to another service (one that’s serverless and no-code/less-code, but where?), and then auto-redirect to the Cloudflare worker.

If those subdomains are hosted, you can add a meta refresh header in HTML.

Cool idea, but it needs to be a server-side redirect, so that it can be followed by non-browser HTTP clients.