Prerequisites
- A Cloudflare Access application and audience tag
- The team domain for your Access team
Steps
1. Provide team and audience
Either env:2. Attach route middleware
Do not put Access on server_middleware.ts. That file cannot pass fields to the handler.
team / audience, Keja reads CF_ACCESS_TEAM_DOMAIN and CF_ACCESS_AUD. Missing values throw project error 2019 when the middleware is created.
3. Call the route through Access
The token is read fromCf-Access-Jwt-Assertion, or from the CF_Authorization cookie when the header is empty. A missing or rejected token returns HTTP 401 (framework error 1005).
Done
The handler receivesaccess only after a valid Access JWT. Identity fields and helpers: Cloudflare Access.