worker routes in wrangler.toml

I'm having troubles understanding how routes works

This works
routes = [{ pattern = "*/assetscdn/*", zone_id = "<zone_id>" }]


This doesn't work
✘ [ERROR] Could not find zone for assetscdn

routes = [{ pattern = "*/assetscdn/*", zone_name = "<zone_name>" }]


This doesn't work
Route pattern may only contain wildcards at the beginning of the hostname and the end of the path: <domain>/*/assetscdn/*

routes = [{ pattern = "<domain>/*/assetscdn/*", zone_name = "<zone_name>" }]


This doesn't works
✘ [ERROR] Invalid URL

routes = [
  { pattern = "*", zone_id = "<zone_id>" },
  { pattern = "*/*", zone_id = "<zone_id>" }
]


This work
routes = [
  { pattern = "*", zone_name = "<zone_name>" },
  { pattern = "*/*", zone_name = "<zone_name>" }
]


Is there an implementation difference or I'm missing something?
Was this page helpful?