-2

For every user I'm getting the constant 10.0.0.90 in my header settings. We were using it to get the country code using the client IP but because of this change, it is resulting in an error. Any guesses?

  • duplicate https://stackoverflow.com/questions/15699101/get-the-client-ip-address-using-php – scaff Jan 19 '22 at 07:50
  • Or this - https://stackoverflow.com/questions/60090938/how-to-get-real-ip-of-visitor-if-our-app-is-behind-a-reverse-proxy – Hendrik Jan 19 '22 at 07:52
  • Does this answer your question? [How to get real ip of visitor if our app is behind a reverse proxy?](https://stackoverflow.com/questions/60090938/how-to-get-real-ip-of-visitor-if-our-app-is-behind-a-reverse-proxy) – Junior Jan 20 '22 at 05:17
  • Because of what change? Could you elaborate on that? as others mentioned, you're probably behind a reverse proxy like `nginx`, and should try to get the IP from the specific header that the proxy decides. Usually Real_IP or last part of X-Forwarded-For. – aliqandil Jan 21 '22 at 23:59
  • Does this answer your question? [Why is $\_SERVER\['REMOTE\_ADDR'\] showing a wrong ip?](https://stackoverflow.com/questions/36466348/why-is-serverremote-addr-showing-a-wrong-ip) – aliqandil Jan 21 '22 at 23:59

1 Answers1

0

My guess is that there's a proxy between the Internet and the server. In such situation, check the Forwarded-For headers' family, for example X-Forwarded-For.

Attention! Don't trust all IP's from X-Forwarded-For as they can be set by clients. Take the first one from the right, which is not set by your infrastructure (utilize trusted proxies approach). Unfortunately, you have to know your network architecture.

How to use HTTP_X_FORWARDED_FOR properly?

Malipek
  • 196
  • 5