Skip to content

Edge feature flags: evaluating flags in Cloudflare Workers, Vercel and other edge runtimes

How feature flags work at the edge: three models (evaluate in the edge function, call an API, run a nearby proxy), a sourced comparison of LaunchDarkly, GrowthBook, Statsig, Cloudflare Flagship, the Vercel Flags SDK, ConfigCat and more, and tested code.

7 min read

Short answer: At the edge, the fast option is to evaluate flags inside the edge function, with the flag rules already stored at the edge in a key-value store or edge config. LaunchDarkly, GrowthBook, Statsig, Cloudflare Flagship and the Vercel Flags SDK work this way. Calling a flag API from the edge adds a network round trip to every request.

What are the ways to use flags at the edge?

Model How it works Latency per check Examples
Evaluate in the edge function Rules are synced into an edge store (Workers KV, Vercel Global Config, Akamai EdgeKV, Fastly KV); the function reads them and evaluates locally No call to the flag service, but a read from the edge store per request or per cached isolate LaunchDarkly edge SDKs, GrowthBook edge with its KV webhook, Statsig with KV or Edge Config, Cloudflare Flagship, Vercel Flags SDK with Global Config
Fetch rules and cache them The SDK downloads the config from the vendor and caches it in the function or the platform's cache A download when the cache is empty or expired ConfigCat's Cloudflare Worker SDK, Reflag's EdgeClient, Optimizely on Cloudflare Workers
Call a flag API from the edge Each request asks a remote service for the result A network round trip DevCycle's cloud server SDK, which calls its Bucketing API
Run a proxy near your apps A cache you deploy, such as Unleash Edge or the Flagsmith Edge Proxy, serves SDKs from your network A hop to the proxy, or none for SDKs that evaluate locally Not edge functions; the name only means "close to your apps"

The first model is what people usually mean by edge flags: the decision happens in the same isolate that handles the request.

Which tools support edge runtimes?

From each vendor's documentation, read on 15 November 2026.

Tool Edge platforms How flag data gets to the edge Updates Notes
LaunchDarkly Cloudflare, Vercel, Akamai, Fastly Integrations write flag data to Workers KV, Vercel's edge config, Akamai EdgeKV or a Fastly KV store Pushed on change ("as they occur" on Cloudflare); the Akamai SDK caches for 100 ms by default; the Fastly SDK reads KV once per request instance Cloudflare integration on select plans; Akamai and Fastly integrations on Enterprise; edge SDKs not available in the EU or federal instances
GrowthBook Cloudflare Workers, Fastly Compute, others through generic edge utilities An SDK webhook pushes the payload to Cloudflare KV or Fastly KV; without it, a blocking API call per request, reduced by a just-in-time cache Webhook gives "immediate access to the latest values" Edge app can run URL-redirect experiments at the edge (set RUN_URL_REDIRECT_EXPERIMENTS=edge; browser by default)
Statsig Cloudflare Workers, Vercel Statsig pushes configs to Workers KV or Vercel Edge Config (now Global Config) Take effect the next time the client initializes ID lists aren't synced, so large ID lists can't be checked at the edge
Cloudflare Flagship Cloudflare Workers natively; SDKs also for Node.js, Bun, Deno, browsers, Python, Go and Rust Config in a Durable Object, synced to Workers KV; read through a Worker binding Synced to KV "within seconds" Public beta since May 2026; built on OpenFeature; pricing to come "as we approach general availability"
Vercel Flags SDK Vercel Routing Middleware, Next.js and SvelteKit Definitions in Vercel Global Config (formerly Edge Config), or a provider such as LaunchDarkly, Statsig, GrowthBook or Flagsmith Depends on the provider Precompute pattern serves static variants from the CDN
ConfigCat Cloudflare Workers SDK fetches the config from ConfigCat's CDN and caches it Polling every 60 seconds by default; lazy loading or manual refresh recommended for short-lived Workers
DevCycle Vercel; Cloudflare Workers through the cloud server SDK Syncs project config into Vercel Global Config for its Node.js and Next.js SDKs; the cloud SDK calls the Bucketing API Not stated A typical configuration won't fit Vercel's Hobby size limit, per DevCycle; part of Dynatrace since January 2026
Reflag Cloudflare Workers Node SDK's EdgeClient (needs Node.js compatibility) fetches definitions on a new instance's first request and caches them in memory Refreshed in the background when the cache expires, at most once per second Send events with ctx.waitUntil(reflag.flush())
Optimizely Akamai EdgeWorkers, Cloudflare Workers, Fastly Compute, Lambda@Edge, Vercel Functions; plus Optimizely Edge Agent On Cloudflare Workers, the datafile is fetched and cached with Cloudflare's cache API (optional KV store) Not checked Other platforms not checked

Sources:

How fast is it?

Vendors publish few numbers. Vercel's Flags SDK docs say its own Global Config is "read in under 1ms at p90 and under 15ms at p95", including the network latency. For in-process evaluation itself, our local vs remote evaluation benchmark measured microseconds per check in Node.js; we haven't measured inside edge runtimes. The bigger cost at the edge is usually getting the data: a KV read, a cold isolate or a cache miss.

What does an edge evaluation look like in code?

The pattern is the same everywhere: load the rules from the edge store, evaluate with request data, and act on the result. This handler uses @openfeature/flagd-core 5.0 to evaluate a flagd rule on the visitor's country and redirect visitors in some countries to a new pricing page; everyone else goes on to the origin. We ran it in Node.js with standard Request and Response objects and a stubbed fetch; on a real edge platform the JSON would come from KV or a bundled file:

import { FlagdCore } from '@openfeature/flagd-core'

const FLAGS = JSON.stringify({
  flags: {
    'new-pricing-page': {
      state: 'ENABLED',
      variants: { on: true, off: false },
      defaultVariant: 'off',
      targeting: { if: [{ in: [{ var: 'country' }, ['DE', 'FR', 'ES']] }, 'on', 'off'] },
    },
  },
})

const core = new FlagdCore()
core.setConfigurations(FLAGS)

async function handle(request) {
  const url = new URL(request.url)
  const country = request.cf?.country ?? request.headers.get('cf-ipcountry') ?? 'XX'
  const visitorId = request.headers.get('cookie')?.match(/visitor=([\w-]+)/)?.[1] ?? 'anonymous'
  const { value } = core.resolveBooleanEvaluation('new-pricing-page', false, { targetingKey: visitorId, country })
  if (url.pathname === '/pricing' && value) {
    url.pathname = '/pricing-v2'
    return Response.redirect(url.toString(), 307)
  }
  return fetch(request)
}
// DE -> 307 to /pricing-v2; US -> passed through to the origin

In a Cloudflare Worker, request.cf.country holds the visitor's country (XX when unknown, T1 for Tor); the cf-ipcountry header needs Cloudflare's visitor location headers enabled. Other platforms have their own geolocation fields. The targeting key is a visitor ID from a cookie, so any percentage rollout buckets visitors, not whole countries.

What goes wrong at the edge?

  • Missing context. The edge function only knows what's in the request. The Flags SDK docs say a network request or database read for context inside middleware "should be avoided at all costs"; put what you need in a signed or encrypted cookie at sign-in, so users can't edit it to unlock flags.
  • Store size limits. KV and edge config stores have size limits. LaunchDarkly warns that store limits may be smaller than your flag data, Statsig doesn't sync ID lists at all, and DevCycle says a typical configuration won't fit Vercel's Hobby limit. Keep edge flags few and small.
  • Update timing. Statsig's KV configs apply on the next client initialization; LaunchDarkly's Fastly SDK reads KV at initialization and doesn't pick up changes within a request instance; ConfigCat polls. A change isn't instant everywhere.
  • Cost of writes. On Vercel, every flag or segment change synced by LaunchDarkly's integration is a Global Config write, which Vercel bills (LaunchDarkly).
  • Events and analytics. Edge functions end quickly; flush events inside waitUntil, as Reflag's and Statsig's edge docs show, or exposure data is lost.
  • Two "Edge" products that aren't edge functions. Unleash Edge and the Flagsmith Edge Proxy are caches you run in your own infrastructure. They help latency and resilience, but they don't run in Cloudflare or Vercel. The open-source edition of Unleash Edge reaches end of life on 31 December 2026.

When should I evaluate flags at the edge?

  • Routing and redirects, such as a new page for some countries or a beta for signed-in users, where deciding before the origin saves a round trip.
  • Static pages with variants: the Flags SDK's precompute pattern evaluates in middleware and serves a cached static variant per combination.
  • Experiments that would otherwise flicker in the browser, like GrowthBook's edge URL redirects.

For flags that depend on data only your backend has, evaluate on the server; for Next.js specifically, see feature flags in Next.js, and for regional functions, feature flags in AWS Lambda. For how evaluation location affects speed and outages, see local vs remote evaluation and OpenFeature explained. All tools are in the directory.