Workers with same sub-domain possible?

Just wondering.

I have a worker called Users which handles user management as an API. I also have another worker handling Logins as an API. And a third worker handling say blog posts as an API.

Is it possible to have all three workers use the same URL without combining into a single worker?

For example:

Right now I have each worker with different routes

Thanks

You should be able to use routes to be able to achieve this.

I received this message when publishing the second worker:

Custom Domains already exist for these domains:
        • api.mydomain.com(used as a domain for "user")
Update them to point to this script instead? (y/n)

This leads me to believe that api.mydomain.com will shift from the first worker to the second worker. Or am I assuming that incorrectly?

I have this in the wrangler file of all three workers:


routes = [
	{ pattern = "api.mydomain.com", custom_domain = true, zone_name = "mydomain.com" }
]

Thanks

You don’t want them to be a custom domain.

Should be something like

routes = [
	{ pattern = "api.mydomain.com/users",  zone_name = "mydomain.com" }
]