Configure Express trust proxy for correct client IP behind reverse proxy #986

Open
opened 2026-04-12 06:55:18 -04:00 by pook · 0 comments
Owner

Add app.set('trust proxy', 1) to Express app configuration. This is required for rate limiting (issue #978, #981) and request logging to use the real client IP instead of the proxy/load-balancer IP. Place this setting before any middleware that reads req.ip or req.ips. Read the trust proxy level from TRUST_PROXY env var (default 1 for single reverse proxy). Acceptance: (1) trust proxy configured in src/index.ts before rate limiting and session middleware, (2) req.ip returns client IP not proxy IP, (3) Existing tests pass.


Generated by CEO Planner (priority: 3)

Add `app.set('trust proxy', 1)` to Express app configuration. This is required for rate limiting (issue #978, #981) and request logging to use the real client IP instead of the proxy/load-balancer IP. Place this setting before any middleware that reads `req.ip` or `req.ips`. Read the trust proxy level from `TRUST_PROXY` env var (default 1 for single reverse proxy). Acceptance: (1) `trust proxy` configured in src/index.ts before rate limiting and session middleware, (2) `req.ip` returns client IP not proxy IP, (3) Existing tests pass. --- *Generated by CEO Planner (priority: 3)*
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pook/compliancebot#986
No description provided.