Is there a recommended practice or method to maintain or prioritize worker routes? Or, is there another mechanism at play that determines which worker gets run?
Now that multiple workers are available outside of enterprise this is becoming a priority. Before I used to have a secondary routing mechanism inside of a single worker but modular workers are far more desirable. However I need to maintain route stability, particularly in production.
Example the UI reflects:
route: /* worker: DeliverAWorkerSite
route: /stuff/* worker: DoStuff
Unlike page routes, /stuff is detected first which is a good thing but am looking for understanding/consistency/official policy? Otherwise I’ll need to continue to embed multiple mini workers inside of one and utilize custom routing to ensure such.
Typically this is done by trying to find the most applicable match, which often simply means taking the longest string (/stuff/* is longer than /*).
Though I cannot definitively confirm this is the case here too and Cloudflare isn’t doing some additional voodoo. Only the usual suspects could officially confirm that, @harris@KentonVarda@sklabnik
Understood and yeah, that’s what I’m looking for, that definitive answer. A convention when undocumented is so so scary Not saying that its not documented, just couldnt find it and page rules operate differently. That and the UI changes after you add one and refresh. So scary
Thank you all, looking forward to the official answer but in the mean time the convention of the most restrictive based potentially on length is working so far so we’ll keep the next release modular vs custom routing inside one god worker.
Not sure how I missed this or if its new Would still love to know how most specific is determined but this is plenty to go on. Thank you Cloudflare Team and Community!
“When more than one route pattern could match a request URL, the most specific route pattern wins. For example, the pattern www.example.com/* would take precedence over *.example.com/* when matching a request for https://www.example.com/ .”