worker routes in wrangler.toml
I'm having troubles understanding how routes works
This works
This doesn't work
✘ [ERROR] Could not find zone for assetscdn
This doesn't work Route pattern may only contain wildcards at the beginning of the hostname and the end of the path: <domain>/*/assetscdn/*
This doesn't works ✘ [ERROR] Invalid URL
This work
Is there an implementation difference or I'm missing something?7 Replies
The top 3, with infix wildcards, are not supported
All 3? Because in my test the first one works
If you're trying to allow
/assetcdn/*
on all domains then it would - I'm just saying that example.com/*/assetscdn/*
wouldn't be valid.
Hence why the third doesn't work, I just assumed the two above were attempting to accomplish the same thing*/
would be all domains therefore it breaks due to a specified domain
Then wildcards need to be at the start (above) or the end /*
You'd need to just do example.com/assetscdn/*
to serve everything under /assetscdn/*
Alright this make sense for the 3rd one which is invalid, but why the first two are different?
I think I found out: https://github.com/cloudflare/workers-sdk/blob/main/packages/wrangler/src/zones.ts#L28
GitHub
workers-sdk/zones.ts at main · cloudflare/workers-sdk
⛅️ The CLI for Cloudflare Workers®. Contribute to cloudflare/workers-sdk development by creating an account on GitHub.
But I don't understand why you need zone_name if you have zone_id to get the host, or maybe I'm missing something