Back

Adding User-Agent to NEXTJS SSR for User Session Record

  • 0
  • Web
  • Cloud
KweeBoss
3 Jan, 2024, 06:30

I am currently implementing AppWrite Cloud to use with NextJs 14. Current status: I can log-in and persist user with domain by passing back the cookie through NextJS API (server-side proxy for authentication).

I would like to add "user-agent" and IP to record full session forward.

TypeScript
    const clientIP = request.headers.get('x-forwarded-for') || request.headers.get('cf-connecting-ip') || 'unknown';```


What should be the header key to pass on REST api call? I look for the documentation and also JS SDK yet no luck. May I ask your a little guidance please?
TL;DR
The user is trying to record the user-agent and IP in a session using AppWrite Cloud and NextJS 14. They are asking for guidance on what the header key should be to pass in the REST API call. However, no solution is provided in the thread.
ideclon
3 Jan, 2024, 18:30

User Agent would be User-agent: , wouldn’t it?

ideclon
3 Jan, 2024, 18:31

And you can’t just tell an upstream server that your IP is something different to what it actually is. If you were self-hosting Appwrite, you could configure it to accept your X-Forwarded-For header. But allowing that on Cloud would be a tremendous security risk.

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more