Skip to content

Run the control plane next to its database and skip the session JWT header - #286

Merged
tnkuehne merged 1 commit into
mainfrom
worker-placement-and-session-jwt
Nov 22, 2026
Merged

tnkuehne merged 1 commit into
mainfrom
worker-placement-and-session-jwt

Conversation

@tnkuehne

@tnkuehne tnkuehne commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Each control-plane request runs several database queries in a row. On a Cloudflare installation the Worker runs in the location nearest the visitor, so every query crosses the distance to the database: Cloudflare's Hyperdrive docs give 20–30 ms per query without placement and 1–3 ms with it. A remote query such as getApps makes 7 queries: session, user, signing keys, membership, then the app list in a transaction. Its server time on a hosted installation is about 230 ms.

Changes

  • Placement: the hosted installation profile accepts placementRegion, for example aws:eu-central-1. The control plane is then deployed with placement: { region } and runs next to the database. Static assets are still served from the location nearest the visitor. App runtime, builder and documenter Workers are unchanged.
  • Session JWT header: the JWT plugin signed a JWT for the set-auth-jwt header on every session lookup, which read the signing keys from the database each time. Nothing reads that header, so disableSettingJwtHeader turns it off. The OAuth provider for the CLI and MCP clients still signs its tokens with the plugin's keys.

Validation

  • pnpm check
  • hosted-installation.test.ts, including a new test for placementRegion
  • mcp-login-runtime.test.ts, auth.integration.test.ts, auth-cli.integration.test.ts
  • Browser tests: 93 passed, 1 skipped. The CLI login suite did not run locally because the CLI binary was not built.

Documentation: #287 (draft until a release includes this change).

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

The PR appears safe to merge; no actionable issues were found.

Summary

Adds optional placementRegion to hosted installations and disables the unused session JWT response header.

  • Hosted control planes can run in their database’s cloud region.
  • Session lookups stop adding an unused JWT header.

Reviews (1) · Last reviewed commit: "Run the control plane next to its databa..." · Reviewed by Greptile

…eader

Every control-plane request runs several database queries in a row. From
the Cloudflare location nearest the visitor, each one costs 20 to 30 ms.
A hosted installation can now name its database's cloud region with
placementRegion, so the control plane runs next to the database.

The JWT plugin also signed a session JWT for the set-auth-jwt header on
every session lookup and read the signing keys from the database each
time. Nothing reads that header. The OAuth provider still signs its tokens
with the plugin's keys.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
widefleet-docs 0a9d3d4 Nov 22 2026, 12:10 PM

@tnkuehne
tnkuehne merged commit 767fe11 into main Nov 22, 2026
15 checks passed
@tnkuehne
tnkuehne deleted the worker-placement-and-session-jwt branch November 22, 2026 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant