Deploy a Worker on a route pattern
deploy & domains
// what it does
Binds the Worker to a URL pattern within a zone you already run through Cloudflare, so it intercepts matching requests while everything else still reaches your origin. This is the tool for bolting edge logic — auth, redirects, an /api/* handler — onto an existing site. Trailing wildcards match by path prefix.
// shell
$ wrangler deploy --route "example.com/api/*"// gotcha
The route's zone must be active on your account, and an apex or cross-zone pattern usually needs the zone named explicitly (in config as { pattern, zone_name }); a route over a hostname with no DNS record just returns errors.