cloudflare worker route triggers
Is it possible to trigger a worker inversely? So for example.. trigger on all routes except for /api*
4 Replies
You could add
example.com/*
, Worker: Your_Worker
And then another route
example.com/api*
, Worker: NoneIf i had another worker handling example.com/api* would that pick up if i did that?
The more specific route wins, yes: https://developers.cloudflare.com/workers/configuration/routing/routes/#matching-behavior
If your question was how to add the Worker: none, in the Cloudflare dashboard, under your website, you can click Worker Routes there, and add that route, ex:
Routes · Cloudflare Workers docs
Routes allow users to map a URL pattern to a Worker. When a request comes in to the Cloudflare network that matches the specified URL pattern, your …
👍 thank you, that was what i thought and wanted to make sure i read right
Then there is something odd about the code that is forcing it to not fire the other worker ill have to look at. Im thinking about how to try to merge the 2