Skip to content

Function: gateRequest()

gateRequest(req, options): Promise<GateAction>

THE gating decision, for one request, independent of how it will be answered.

Both paths call this: the Express middleware below (where the app is the process) and @dbx-tools/cli-tunnel’s reverse proxy (where the app is a child process on a private port). A divergence between them would be a security bug the second path could not be tested into agreement - one path forgetting to strip x-forwarded-access-token is enough - so the decision, the header rewriting, and the identity injection live here once and the transports only differ in how they WRITE the outcome.

Mutates req.headers on the allow/pass-with-cookie paths, which is exactly what both callers want: Express hands the same object to the app’s handlers, and the proxy forwards it upstream.

IncomingMessage

GateOptions & object

Promise<GateAction>