Skip to content

fix: enable trust proxy for correct client IP resolution#185

Open
jakebromberg wants to merge 1 commit intomainfrom
fix/24-trust-proxy
Open

fix: enable trust proxy for correct client IP resolution#185
jakebromberg wants to merge 1 commit intomainfrom
fix/24-trust-proxy

Conversation

@jakebromberg
Copy link
Member

Summary

  • Adds app.set('trust proxy', true) to apps/backend/app.ts so that req.ip returns the real client IP instead of the load balancer's IP when running behind a reverse proxy.
  • Adds a unit test (tests/unit/config/trust-proxy.test.ts) that reads the app source and asserts the trust proxy setting is present.

Closes #24

Test plan

  • New unit test fails without the fix and passes with it
  • Verify req.ip returns the correct client IP in staging behind the ALB/reverse proxy
  • Confirm IP-based rate limiting works correctly with real client IPs

Made with Cursor

Without trust proxy, req.ip returns the load balancer IP, making
IP-based rate limiting ineffective behind a reverse proxy.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant