diff --git a/backend/src/utils/misc.ts b/backend/src/utils/misc.ts index d838ed3ab..b2f136b20 100644 --- a/backend/src/utils/misc.ts +++ b/backend/src/utils/misc.ts @@ -44,7 +44,7 @@ export function base64UrlDecode(data: string): string { } interface AgentLog { - ip: string | string[]; + ip: string; agent: string; device?: string; } @@ -54,8 +54,8 @@ export function buildAgentLog(req: MonkeyTypes.Request): AgentLog { const agentLog: AgentLog = { ip: - req.headers["cf-connecting-ip"] || - req.headers["x-forwarded-for"] || + (req.headers["cf-connecting-ip"] as string) || + (req.headers["x-forwarded-for"] as string) || req.ip || "255.255.255.255", agent: `${agent.os.name} ${agent.os.version} ${agent.browser.name} ${agent.browser.version}`,