Next.js Discord

Discord Forum

How do I access geo information from the request for server components?

Unanswered
Broad-snouted Caiman posted this in #help-forum
Open in Discord
Broad-snouted CaimanOP
I understand how to access it on routes via middleware and could theoretically pass this down to the components via prop drilling, but it seems like this shouldn't be necessary -- the server component model avoids prop drilling in the case of e.g. database data, so it seems like it should be able to afford the same thing for request info.

3 Replies

Yellowstripe scad
hi @Broad-snouted Caiman were you able to make this work? so far from what i have read it will depend on your host. If you are using Vercel you can access in the middleware for the geo information. However i am still looking for a way to pass it to components.
right. Vercel relys on Cloudflare Edge, which has a mechanism to get geo info. you might want to try Cloudflare directly to get a better understanding how it works behind the scenes.