fix(api): 🐛 get correct client ip even through server proxy
This commit is contained in:
parent
7568cb43a6
commit
ad34e6a3e4
|
@ -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 })
|
||||
|
|
Loading…
Reference in a new issue