Workers
Standalone Cloudflare Workers and Wrangler configuration
Cloudflare Workers are serverless functions that run at the edge. They can be standalone services or part of a Pages project (as Pages Functions).
Workers vs Pages Functions
| Workers | Pages Functions | |
|---|---|---|
| Deployment | wrangler deploy | wrangler pages deploy (with static site) |
| Routing | Custom routes or *.workers.dev | File-based from functions/ directory |
| Use case | Standalone APIs, webhooks, proxies | API endpoints alongside a static site |
| Config | Full wrangler.toml | wrangler.toml for bindings only |
When to Use Standalone Workers
Use standalone Workers when:
The function is a separate service (e.g., search worker, AI chat worker)
You need custom domains or routing
The worker has its own release cycle independent of the static site
You need features not available in Pages Functions
In This Section
Wrangler Config -- Configuration file format and options
Standalone Workers -- Deploying independent Workers
Compatibility Dates -- Understanding and managing compatibility dates
Durable Objects -- WebSocket Hibernation and SQLite-backed Durable Objects
Static Assets -- the [assets] binding, run_worker_first, and the preview-URL trap
Browser Caching for Hashed Assets -- the
_headersimmutable rule for content-hashed bundles, 103 Early Hints, and why full CSS inlining is the wrong fixDeploy from Zero -- provisioning a repo-based Worker from scratch and its non-obvious traps
Local Dev: Binding Support Matrix -- which bindings emulate locally in
wrangler dev, and the credential-free e2e config patternRuntime Gotchas -- self-fetch hostnames, stored fetch responses, waitUntil/scheduled budgets, binding-wrapping libraries, the cloudflare:workers ambient env, and CORS vs WebSocket
Pages to Workers Migration -- moving a live site from Pages to Workers Static Assets with minimal downtime, and rolling back cleanly if it doesn't go well
Workers Cache (ctx.cache) -- the edge-level cache.enabled / ctx.cache feature -- version floor, Cache-Control/Cache-Tag/Vary, ctx.cache.purge scoping, Cf-Cache-Status, the Next.js ISR question, and why verification only works against a deployed Worker