Next.js Discord

Discord Forum

Next 13 App Router Request IP

Answered
Argentine ant posted this in #help-forum
Open in Discord
Argentine antOP
Is there a way to get the request IP within an app router component? The component will always be server rendered anad we need to get the request IP as well. I can get the X-Forwarded-For but we'll sometimes need the raw request IP (the forwarded for header isn't always set). I don't see a way to access the raw IP via the request though?
Answered by joulev
Get the request ip in middleware and pass it to the server component as a header
View full answer

3 Replies