MCPcopy Index your code
hub / github.com/coder/mux / extractClientIpAddress

Function extractClientIpAddress

src/node/orpc/authMiddleware.ts:52–62  ·  view source on GitHub ↗
(
  headers: IncomingHttpHeaders | undefined
)

Source from the content-addressed store, hash-verified

50}
51
52export function extractClientIpAddress(
53 headers: IncomingHttpHeaders | undefined
54): string | undefined {
55 const forwardedFor = getFirstHeaderValue(headers, "x-forwarded-for");
56 if (!forwardedFor) {
57 return undefined;
58 }
59
60 const first = forwardedFor.split(",")[0]?.trim();
61 return first?.length ? first : undefined;
62}
63
64export function extractCookieValues(
65 cookieHeader: string | string[] | undefined,

Callers 2

createAuthMiddlewareFunction · 0.85

Calls 1

getFirstHeaderValueFunction · 0.70

Tested by

no test coverage detected