Edge Redirect Engine

Node.jsTypeScriptCloudflare Workers
Edge Redirect Engine illustration

Overview

Edge Redirect Engine resolves and serves redirects from the network edge instead of a central origin. The distinction matters more than it first appears. A redirect served from one region means a user on the other side of the world pays a round trip before the page they actually wanted even begins loading — and a redirect is, by definition, pure overhead on the way to somewhere else.

Built in TypeScript on Cloudflare Workers, the engine executes at the edge location nearest the request. There is no cold origin to wake and no database round trip on the hot path. For campaign links, QR codes and short links — where a burst of traffic can arrive the moment a post goes out — this is the difference between a redirect that is invisible and one that users notice.

The engine handles straightforward one-to-one redirects as well as conditional routing: sending mobile and desktop traffic to different destinations, routing by country, or splitting traffic across destinations for testing. Because it runs on Workers rather than servers you provision, capacity is not something you plan for — a link doing a hundred requests a day and one doing a hundred thousand require the same amount of operational attention, which is none.

Built for Impact

Advanced features that power your digital infrastructure.

Edge Execution

Redirects resolve at the Cloudflare location nearest the user, removing the round trip to a central origin that makes redirects feel slow.

Conditional Routing

Route by device, country, language or referrer, so one link can send mobile users to an app store and desktop users to the web equivalent.

A/B Traffic Splitting

Distribute traffic across multiple destinations by weight, letting you test landing pages behind a single link without changing what you published.

No Capacity Planning

Workers scale with demand, so a link that suddenly goes from quiet to viral needs no provisioning and no intervention.

Link Expiry and Guards

Time-limited links, password protection and destination validation, so a campaign link can be retired without leaving a dead URL in circulation.

Request Analytics

Click counts with geography, device and referrer, captured without adding latency to the redirect itself.

Specs

Architecture

Edge

Language

Node.js / TypeScript

Platform

Cloudflare Workers

Deployment

Global Edge Network

Latency

Ultra Low

Use Case

Link Redirection

How It Works

1

Request hits the edge

The request lands at whichever Cloudflare location is closest to the user, typically within a few tens of milliseconds. Nothing has travelled to a central server yet, which is the entire point — the redirect is overhead on the way to the real destination and should cost as little as possible.

2

Resolve the destination

The engine looks up the slug in edge-replicated storage rather than querying a database across the network. For a plain redirect this is the whole decision; for a conditional one, device, country and referrer are evaluated here too.

3

Respond and record

A redirect response is returned immediately, then the click is recorded asynchronously. Analytics never sit between the user and their destination, so instrumentation costs nothing in perceived speed.

4

Propagate changes

Updating a destination pushes the new mapping out to edge locations. A link can therefore be repointed after it has been printed, posted or shared, which is usually why short links were chosen in the first place.

Common Use Cases

Marketing campaign links

Trackable links across email, social and paid channels where traffic arrives in bursts. Edge execution and automatic scaling mean a campaign that lands well does not degrade the experience of the people responding to it.

QR codes and print

Codes on packaging, signage or print, where the destination may need to change long after the artwork is fixed. Repointing the link is the only option available, so it needs to be reliable.

App download routing

One link that sends iOS users to the App Store, Android users to Play, and everyone else to a web page — decided at the edge rather than by a JavaScript redirect after the page has already loaded.

What to Decide Early

Choose a slug scheme you can live with

Short random slugs are compact and unguessable; readable slugs are better in print and speech but invite enumeration and squatting. Mixing both is usually right, with generated slugs by default and custom ones where a human will read the link aloud. Changing the scheme later leaves you supporting two formats indefinitely, since links already printed never go away.

Plan for links outliving campaigns

A link on packaging or signage will be scanned long after the campaign behind it ends. Deciding now where expired links should land, ideally a relevant page rather than a 404, turns dead scans into recovered traffic. This is the most common avoidable loss with printed short links, and it costs nothing to prevent.

Keep conditional rules understandable

Device, country and referrer routing are powerful and compound quickly. A link with several overlapping conditions becomes hard to reason about and harder to debug when someone reports landing in the wrong place. Favour a small number of clear rules with an explicit default over an elaborate decision tree nobody can follow six months later.

Frequently Asked Questions

Typically in the low tens of milliseconds, because the request is served by the nearest Cloudflare location rather than travelling to a central origin. The exact figure depends on the user's distance to that edge, not on your server's location.
Nothing you need to do. Workers scale with demand, so a link going from quiet to viral requires no provisioning. This is the main operational advantage over running redirects on servers you size yourself.
Yes. Device, country, language and referrer can all be used as routing conditions, and traffic can be split by weight across destinations for testing.
Yes, and this is usually the reason to use the engine at all. Updated mappings propagate to the edge, so a QR code on printed material can be repointed long after it is out in the world.
No. The redirect response is returned first and the click is recorded asynchronously, so instrumentation never sits between the user and their destination.

Still have questions? Talk to our team

Scale Your Infrastructure

Ready to handle millions of users? Our backend experts are here to build the high-concurrency, secure architecture your mission-critical project demands.

Request Custom Solution