Configure Express trust proxy for correct client IP behind reverse proxy #986
Labels
No labels
agent-task
agent-task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
pook/compliancebot#986
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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 readsreq.iporreq.ips. Read the trust proxy level fromTRUST_PROXYenv var (default 1 for single reverse proxy). Acceptance: (1)trust proxyconfigured in src/index.ts before rate limiting and session middleware, (2)req.ipreturns client IP not proxy IP, (3) Existing tests pass.Generated by CEO Planner (priority: 3)