MCPcopy Create free account
hub / github.com/AmazingAng/PolyWorld / getClientIP

Function getClientIP

src/middleware.ts:70–76  ·  view source on GitHub ↗
(req: NextRequest)

Source from the content-addressed store, hash-verified

68}
69
70function getClientIP(req: NextRequest): string {
71 return (
72 req.headers.get("x-forwarded-for")?.split(",")[0].trim() ||
73 req.headers.get("x-real-ip") ||
74 "unknown"
75 );
76}
77
78function checkRateLimit(
79 ip: string,

Callers 1

middlewareFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected