Skip to content

Commit 03e2cce

Browse files
Enable Express trust proxy for client IP forwarding
Allows rate limiting to work per actual client IP instead of ingress pod IP when running behind NGINX Ingress.
1 parent 71c1ec1 commit 03e2cce

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

backend/routes.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ export const app = express();
1212
app.set("port", process.env.PORT || 5000);
1313
app.set("json spaces", 2);
1414

15+
// Trust proxy to get real client IPs behind NGINX Ingress
16+
// This allows rate limiting to work per actual client IP instead of per ingress pod IP
17+
app.set("trust proxy", true);
18+
1519
app.use(logger("combined"));
1620

1721
// Global rate limiting for all requests (including static files)

0 commit comments

Comments
 (0)