The core concept
Your origin server never
knows a Worker exists.
A Cloudflare Worker intercepts HTTP requests that match a Route pattern (e.g. *shoplegacy.com/*). Your origin receives a perfectly normal request, returns a normal response, and the Worker transforms it on the way back โ invisibly.
Origin code unchanged
0 lines edited
DNS unchanged
same domain, same records
Deploy in 10 seconds
one command: wrangler deploy
Browser
sends request
Your Origin
unchanged โ
Click "See how routes work" to animate
Everything you need โ 2 files + 1 command
A small TypeScript file. It fetches from your origin, optionally transforms the response, and returns it. Your origin gets a normal HTTP request.
await fetch(request) // calls your origin
.then(res => transform(res)) // modifyOne line in wrangler.toml tells Cloudflare which URLs this Worker intercepts. Pattern supports wildcards. Multiple routes supported.
pattern = "*shoplegacy.com/*"One command. Worker is live globally in ~10 seconds on Cloudflare's 250+ PoPs. Rollback is one command too.
wrangler deploy # doneTotal changes to your origin: 0 โ Not one line. The Worker is deployed independently on Cloudflare's infrastructure, not on your servers.
Same URL. Two different experiences.
Left: origin only ยท Right: Worker route active (chatbot injected via HTMLRewriter)
Other things the same route can do