Skip to content

Cloudflare lets Workers sit inline in its secure web gateway

Gateway and DLP policies can now call out to a Worker mid-request, turning fixed rule configs into code you write yourself.

Source: Cloudflare

Cloudflare announced today that its Zero Trust Gateway and Data Loss Prevention products can now hand off to a Worker in the middle of a request instead of only matching static rules.

The headline feature is a new Forward action, in public beta today, which routes matched HTTP traffic to a Worker acting as inline middleware: it can rewrite headers or the body, forward to origin, and modify the response before it reaches the user. A related Custom Functions feature, due before the end of the year, lets a Worker run during policy evaluation and return a typed value such as a string or boolean that other rules can then match on. DLP gets its own hook today too: a custom validation function can check whether a flagged match, like a string that looks like a GitHub token, is actually live before DLP blocks it. Traffic sent to these Workers is billed as ordinary Worker requests.

export class GatewayMiddleware extends WorkerEntrypoint {
  async handle(request, context, next) {
    request.headers.set('X-Gateway-Client-IP', context.srcIp);
    const response = await next(request);
    response.headers.set('X-Processed-By', 'gateway-middleware');
    return response;
  }
}

Why it matters: anyone running Cloudflare Gateway or DLP has been limited to fixed rule syntax for conditions and enforcement. Being able to write a Worker that decides the outcome means custom identity checks, live-credential verification, and request rewriting can live in the policy path itself, not in a bolt-on proxy.

Share

Related reading

More from The Wire

All briefs

Ai2 ships MolmoWeb 2, open web agents that see the page

Three open-weight visual web agents, 4B up to 27B parameters, trained with reinforcement learning to browse real websites by screenshot rather than HTML. The 27B model edges out Claude Opus 4.6 on browsing benchmarks.

via Allen Institute for AI (Ai2)

node-tar patches a Windows RCE bug triggered by npm install

A newline-injection flaw in node-tar let a crafted archive forge its own file paths and run code during npm install on Windows. The fix landed in a string of releases up to 8.1.0 on 2 December.

via GitHub Security Advisories (isaacs/node-tar)