Glossary · Cloud & Hosting

Cloudflare Workers

Cloudflare Workers is a serverless platform that runs JavaScript or WebAssembly code on Cloudflare's edge network, close to the user making the request.

Updated October 6, 2026

Cloudflare Workers is a serverless platform that executes your code on Cloudflare's global edge network. A Worker intercepts an HTTP request, can modify it, fetch from an origin or other service, and returns a response, all in a data center near the visitor.

Why it matters

Running logic at the edge removes a round trip to a distant origin. Workers are used for redirects, A/B tests, header changes, authentication checks, API routing and small full applications. They use lightweight isolates rather than whole containers, which keeps startup delay low. Limits apply on CPU time, memory and request size, so heavy processing belongs elsewhere.

Example

export default {
  async fetch(request) {
    const url = new URL(request.url);
    if (url.pathname === "/old") {
      return Response.redirect("https://example.com/new", 301);
    }
    return fetch(request);
  },
};

Requests to /old are redirected at the edge; everything else passes through to the origin.

Common mistakes

  • Putting a buggy Worker route on the whole zone, which turns an error into a site-wide outage.
  • Assuming it is a full Node.js environment; some APIs are unavailable.
  • Forgetting that cached responses may bypass or differ from Worker output.

Get notified when this term updates

Plus occasional practical tips on uptime and monitoring, nothing else. Unsubscribe anytime.

This page is general information written by our editorial team and updated when documentation changes. Servers and providers differ, so test changes safely first. See our editorial policy and disclaimer.