Orphaned Worker routes

When creating a Worker route, either in the web UI or through the API, it’s always done in the context of a zone. You add a route to a zone. Similarly, you list routes for a zone, you get a route on a zone, you update a route on a zone, and you delete a route from a zone.

If you list the workers on an account, each worker includes a list of the routes associated with it (just pattern/script, though - no mention of a zone).

However if you delete a zone, any worker routes set up for it are not deleted - and since the zone no longer exists, it doesn’t seem to then be possible to delete the routes.

Am I missing something in the API? Is there some other way to manage the routes after a zone has been deleted?

You could use workers.dev just and create a routes later to that script. Or setup a worker in one zone and route afterwards manually or through api.

One of my use cases, worker in example.com and then routes on example.co.uk example.fr example.de manually created.

You could use workers.dev just and create a routes later to that script. Or setup a worker in one zone and route afterwards manually or through api.

This is exactly what I am doing. I’ve created a worker, and I later create a zone, and add routes (to the zone) pointing to the worker.

It’s just that I’ve noticed that when the zone gets removed, the routes don’t. It then seems to be impossible to remove the routes, because the zone - through which you manage the routes - no longer exists.

I can’t simulate the behaviour of removing a zone. I have simulated deleting a worker and it deletes the routes on every zone linked.

Please report this behaviour to Support.

“To contact Cloudflare Customer Support, login & go to https://dash.cloudflare.com/?account=support and select get more help. If you receive an automatic response that does not help you, please reply and indicate you need more help.”

1 Like