supabase / auth-helpers

A collection of framework specific Auth utilities for working with Supabase.
https://supabase.github.io/auth-helpers/
MIT License
893 stars 240 forks source link

No way to get connecting client's IP on the Supabase side #714

Open nukeop opened 6 months ago

nukeop commented 6 months ago

Bug report

Describe the bug

When I'm using @supabase/ssr, and establish a session in a client browser, then use a server action in my Next.js application, there is no way to pass the client's IP to Supabase.

For example, when I'm using a browser-side client, the IP is visible in the X-Real-IP header, because the client is connecting directly to the Supabase backend. I can confirm that in the Edge API log browser.

But when I want to run a server action, the connection is now client->Next.js server->Supabase. This extra step loses track of the IP and I see no way to pass it along. The IP displayed in the logs is actually the AWS IP that my Next.js application is running on.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Create a Next.js application and add @supabase/ssr.
  2. Setup the package according to the instructions in the docs.
  3. Write a simple server action, for example for fetching anything from the database.
  4. Perform the action.
  5. Go to the logs in Supabase, and inspect the GET request.

Expected behavior

I'd expect an extra X-something header that would contain the client's actual IP.

ScreenshotsN/A

System information