diff --git a/routes/api/magiclink/index.ts b/routes/api/magiclink/index.ts index 25734ba..70390ac 100644 --- a/routes/api/magiclink/index.ts +++ b/routes/api/magiclink/index.ts @@ -51,7 +51,9 @@ export const handler: SessionHandlers = { // send mail to user try { if (user) { - const ip = ctx.remoteAddr.hostname + // Get user ip through proxy else from tcp connection + const ip = request.headers.get('X-FORWARDED-FOR') ?? + ctx.remoteAddr.hostname const device = request.headers.get('Sec-Ch-Ua-Platform') ?? undefined await sendMagicLink(user, { device, ip, endpoint })