Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions src/http/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,11 @@ export function createApp(): Express {
}),
);

// ── 7. Modules that bypass the rate limiter (health probes) ──
// Mounted BEFORE globalLimiter so k8s probes are never throttled and
// /readyz can still report on Redis health when Redis is the thing
// that's failing.
for (const m of modules) {
if (m.bypassRateLimit) app.use(m.mountPath, m.router);
}

// ── 8. Global rate limit (Redis-backed) ──
app.use(globalLimiter);

// ── 9. Modules that need raw bodies (mounted BEFORE body parsers) ──
// ── 7. Modules that need raw bodies (mounted BEFORE body parsers) ──
// Better Auth's catch-all reads the raw request stream itself, so it MUST
// sit above the body parsers. It carries its own Redis brute-force limiter
// (authLimiter, in its router), so sitting above the global limiter here
// costs it no protection.
for (const m of modules) {
if (m.rawBody) app.use(m.mountPath, m.router);
}
Expand Down
Loading