Cloudflare Connect 2026 · System Sketch · Foundational →

Creating an infinite extensibility layer to your Secure Web Gateway

Leela Kanakala
Sr. Specialist Solutions Engineer — APJ
Giriraj Jayaraman
Principal Specialist Solutions Engineer — ANZ
The finite menu
The policy action menu

Two answers.

Action
Select an action
Allow
Bypass · Redirect · Isolate
Block

When neither is right, the menu has nothing else.

A controlled exception
The missing middle

Not a bypass.
Not a block.

A controlled exception could be:

  • Continue, after a reason.
  • Continue, after redaction.
  • Continue, temporarily.
The third answer

Infinite power.
Any business logic you need.

Gateway Policy Custom Actions

Any logic you can write. Any context you can reach.

The third answer

Custom Actions

A programmable action layer for your SWG policies.

Public beta
Architecture appendix

Custom Actions:
powered by Cloudflare Workers.

End user Cloudflare Custom Actions HTTP request HTTP response Browser Gateway TLS · DLP · AV Origin 1 2 3 4 5 6 7 8
To the board
Architecture

Custom Actions:
powered by Cloudflare Workers.

Cloudflare Browser End user Custom Actions Gateway TLS · DLP · AV Origin
To the board
Architecture

Custom Actions:
powered by Cloudflare Workers.

Cloudflare Browser End user Custom Actions Workers R2 D1 KV Gateway TLS · DLP · AV Origin
To the board
Custom Actions · Cloudflare Workers

Inspect. Mask. Continue.

import { WorkerEntrypoint } from "cloudflare:workers";

export class GatewayMiddleware extends WorkerEntrypoint {
  async handle(request, context, next) {
    const response = await next(request); // Get upstream response
    const type = response.headers.get("content-type") || "";
    if (!response.body ||
        !/^(text\/plain|application\/json)\b/i.test(type)) {
      return response;
    }

    const body = (await response.text()) // Mask sensitive values
      .replace(/[\w.+-]+@[\w.-]+\.[a-z]{2,}/gi, "[EMAIL]")
      .replace(/\b\d{3}-\d{2}-\d{4}\b/g, "[SSN]");

    const headers = new Headers(response.headers);
    headers.delete("content-length"); // Body size has changed
    return new Response(body, { status: response.status, headers });
  }
}
01 / Inspect

Inspect the HTTP response.

Check the content type and read the body.

02 / Mask

Replace sensitive values.

Your code decides what to mask.

03 / Continue

Return the masked response.

Gateway sends it back to the user.

Before · From the origin

{"email": "alex@example.com"}

After · Returned to the user

{"email": "[EMAIL]"}

Illustrative example · data masking in JSON values

Takeaways
01
Move beyond allow or block to achieve any business logic.
02
Bring relevant context to your Gateway policy decisions.
Off-mic · 15 more minutes

Bring your ideas to life.

Come chat with us.

Bring the one rule you were told was impossible.

QR code for https://custom-actions-sf-connect.0security.net/
TRY NOW!!!
Leela Kanakala · leela@cloudflare.com
Giriraj Jayaraman · giriraj@cloudflare.com
H10 · ALTERNATE TAKEAWAY · 0 returns
Takeaways
01
Use the context and business logic your policy needs, not just the controls on a menu.
02
Move beyond allow or deny with a response designed for the situation.
D3 · LEGACY · 0 returns
The request path · where should your answer be allowed to run?
Candidate hook points device CF edge connection TLS HTTPrequest body upstream cheap, but you know almost nothing yet you know the most — and you’re in the hot path … or out of band, entirely off this line
D4 · LEGACY · 0 returns
The detour
device CF edge connection TLS HTTPrequest body upstream your code runs on the request … and continues out to the upstream or you answer it yourself — it never reaches the upstream at all A policy matches → the request detours through code you control → whatever you return is what the user gets
D5 · appendix · 0 returns
Appendix · if it comes up: failure modes
your code doesn’t answer fail open traffic flows — your control silently stopped existing, and nobody called anyone votes fail closed the request dies — the user calls you, within about four minutes votes last known good cached decision, with a staleness window — now you own the window votes Nobody is arguing about JavaScript. They’re arguing about change control, ownership and blast radius.
H6 · 0 returns
Recorded demo
H7 · 0 returns
Shape of the interface
POC-era signature. Confirm against the shipping interface before Connect, or delete this slide.
// Internal POC shape — flagged as likely to change before release.
// Do not put a stale signature in front of a customer.

export default class GatewayMiddleware {
  async handle(request, context, next) {
    // inspect anything on the request
    // return a Response  -> that is what the user gets
    // call next()        -> the request carries on to the upstream
    return next(request);
  }
}

The interesting question was never the signature. It’s what happens when handle throws, hangs, or ships on a Friday.

H11 · alternate · 0 returns
The third answer

Infinite power.
Any business logic you need.

Gateway Policy Custom Actions

Any logic you can write. Any context you can reach.

00:00
clock stopped · t to start

Live controls

2  3hidden boards — D3 the path · D4 the detour (insurance if the live board fails)
4D5 — failure modes, appendix only: use if it comes up in Q&A or the buffer, not a scheduled segment
5H6 — recorded demo (the fallback, B’s call, 20-second rule)
6H7 — interface shape, buffer only, never in the main flow
7H9 — detailed request-path architecture, appendix only
8H10 — fuller takeaway alternate
9H11 — orange infinity alternate
0return to the main flow, exactly where you left it
t  /  rstart-stop / reset the clock — calls time at 15, 30, 40, hard stop 45
sreveal.js speaker view: notes, next slide, timer
f  /  escfullscreen / slide overview
b  /  .black the screen — use this when you turn to the board
?  /  /this panel
Right-arrow past the final main slide is blocked — the hold slide stays up for the full 15-minute buffer. The hidden boards sit after it and are out of the slide count, so a stray click cannot drop you into one.

Both co-speaker variants (PM and SME) are in the speaker notes, tagged. Nothing that is only for the speakers appears on the projected slide.