Next.js Discord

Discord Forum

Next.js on AWS Amplify - Incorrect x-forwarded-for header for IP-based Geolocation Routing

Unanswered
Schneider’s Smooth-fronted Caima… posted this in #help-forum
Open in Discord
Schneider’s Smooth-fronted CaimanOP
Hello,

I have a Next.js application deployed on AWS Amplify.

When accessing the website, middleware determines the region for redirection based on the IP address (for example, mydomain/us).

However, when accessing via the domain, I always get the default region (in my case, /us).

Previously, the application was deployed on Netlify and this issue did not occur.

What could be the problem and how can it be resolved?

*I get the IP address standardly through x-forwarded-for,
I understand that Amplify does not pass the client's IP address.

0 Replies