Detour is a Cloudflare Worker that resolves redirects at the edge — before a request ever reaches your origin — and logs the 404s that slip through. Exact and regex rules, query-string preservation, redirect-chain detection. Built for agencies migrating sites and devs who hate watching 404s pile up.
Detour checks rules in a Cloudflare Worker and returns matching redirects without sending the request to your origin.
Exact rules for one-to-one moves (/old → /new) and regex rules with backreferences for whole sections (^/blog/(.+)$ → /articles/$1). Exact always beats regex; regex is first-match-wins in insertion order, so layered migrations stay predictable.
By default the visitor's query string carries through to the destination — /old?ref=email → /new?ref=email — so your UTM tags and tracking params survive the redirect. Need to drop them? Flip keepQuery:false per rule.
Detour records observed 404 requests with hit counts and first/last-seen timestamps, so you can review broken paths directly. It excludes IP addresses and User-Agents. Paths can still contain personal information, so review your URL conventions.
Migrations stack up chains — A→B→C — that burn crawl budget and waste a hop on every visit. The chain linter flags every redirect whose destination is itself a source, shows you the full chain, and tells you the final target to collapse to. It catches loops, too.
A vanilla-JS admin tool at /admin and a clean control-plane API, both gated by a single X-Detour-Admin secret with constant-time comparison. No secret set means the control plane fails closed. CSV bulk import lets you load a whole migration's rules in one paste.
Add your host as a custom domain on the Detour Worker, or attach the Worker to a yoursite.com/* route on your own Cloudflare zone. Set your real origin so unmatched requests proxy straight through.
Use the admin tool at /admin or the API to add exact and regex redirects — or bulk-import a whole migration from a CSV with a single source,destination,type,regex header.
On every request, the Worker checks the exact rule key first, then the regex list. A hit returns 301/302 immediately — before your origin is touched. A miss proxies through to your real site.
The 404 log surfaces dead links the moment they're hit. Run the chain linter to find A→B→C hops and collapse them to the final target. Clean redirects, fewer 404s, happier crawlers.
Free covers exact 301/302 redirects and a recent 404 log. A license adds regex rules, the unlimited log, CSV import, and the chain detector.
It runs at the edge — in a Cloudflare Worker, before the request ever reaches your origin server. A WordPress redirect plugin only fires after PHP boots; an .htaccess rule only fires once Apache has the request. Detour returns matching redirects from Cloudflare's network without requesting the destination from your origin. Request time still depends on the network and rule lookup.
Regex rules let you redirect whole sections in one line. A source pattern like ^/blog/(\d{4})/(.+)$ with destination /articles/$2 uses $1, $2 backreferences to the captured groups. Exact rules always take precedence over regex, and regex rules are evaluated in insertion order — first match wins — so a big migration stays predictable. Regex is a paid-tier feature.
For observed 404 requests, Detour records the path, hit count, and first-seen and last-seen timestamps, without IP addresses or User-Agents. Paths can still contain personal information, so review your URL conventions. The free view is capped at 50 records; licensed access provides the full log for review.
A chain is A→B→C: an old URL redirects to another URL that itself redirects again. Each hop costs a round-trip and burns crawl budget, and chains tend to pile up across multiple migrations. The chain detector (paid) flags every rule whose destination is itself a source, shows you the full chain and its final target, and catches loops — so you can rewrite A→C directly.
Yes, by default. /old?ref=email → /new?ref=email — the visitor's query string is carried to the destination, and if the destination already has its own query, the two are merged. If you'd rather strip the query on a given rule, set keepQuery:false when you create it.
Two ways: add your hostname as a custom domain on the Detour Worker, or attach the Worker to a yoursite.com/* route on your own Cloudflare zone. Then set your real origin so any unmatched request proxies straight through to your live site — only the paths you've added rules for get redirected. Manage everything from the token-protected admin tool at /admin.