I need to store user’s real ip addresses. I can debug a few properties from the request headers like below.
accept: 'application/json, text/plain, */*',
2022-12-30T06:51:22.286 app[1e9759f6] nrt [info] 'user-agent': 'axios/1.1.3',
2022-12-30T06:51:22.286 app[1e9759f6] nrt [info] 'accept-encoding': 'gzip, deflate, br',
2022-12-30T06:51:22.286 app[1e9759f6] nrt [info] 'x-request-start': 't=1672383082282366',
2022-12-30T06:51:22.286 app[1e9759f6] nrt [info] 'fly-client-ip': '3.38.145.5',
2022-12-30T06:51:22.286 app[1e9759f6] nrt [info] 'x-forwarded-for': '3.38.145.5, 137.66.22.161',
2022-12-30T06:51:22.286 app[1e9759f6] nrt [info] 'fly-forwarded-proto': 'https',
2022-12-30T06:51:22.286 app[1e9759f6] nrt [info] 'x-forwarded-proto': 'https',
2022-12-30T06:51:22.286 app[1e9759f6] nrt [info] 'fly-forwarded-ssl': 'on',
2022-12-30T06:51:22.286 app[1e9759f6] nrt [info] 'x-forwarded-ssl': 'on',
2022-12-30T06:51:22.286 app[1e9759f6] nrt [info] 'fly-forwarded-port': '443',
2022-12-30T06:51:22.286 app[1e9759f6] nrt [info] 'x-forwarded-port': '443',
The problem is, the value inside x-forwarded-for header is always the same and it does not changed neither when I test on my mobile(LTE) nor on my pc(Ethernet). The ip address seems like a local address of Amazon server or maybe the client-side load balancer’s ip. I’m not sure. My client side app is hosted on Vercel.
How can I store a real ip address from the incoming request?