Skip to content

Commit 43f1f61

Browse files
committed
fix: enable trust proxy for correct rate limiting behind reverse proxy
Without this, rate limiting uses the proxy's IP instead of actual client IPs, causing all requests through Cloudflare to be rate limited together.
1 parent da36d62 commit 43f1f61

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ async function main() {
4444

4545
const app = express();
4646

47+
// Trust proxy headers (X-Forwarded-For, etc.) when behind reverse proxy (Cloudflare, etc.)
48+
// This is required for rate limiting to work correctly with real client IPs
49+
app.set('trust proxy', true);
50+
4751
// Basic middleware
4852
// Intentionally permissive CORS for public MCP reference server
4953
// This allows any MCP client to test against this reference implementation

0 commit comments

Comments
 (0)