I am trying to retrieve our users’ public IP addresses for geolocation purposes. Our app is hosted in Galaxy, with no special configuration (as far as I know). In over 50% of cases this.connection.clientAddress and this.connection.httpHeaders["X-Forwarded-For"] contain the same single private IP address (e.g., 10.0.4.225, 10.0.0.46). To be clear, the “X-Forwarded-For” does not contain the expected public IP, just a single private IP.
I think something in Galaxy’s environment configuration is causing the original client IP not to be properly forwarded. But, what is most confusing is why approx. 50% of IP addresses are received correctly.
I read that I should set the HTTP_FORWARDED_COUNT environment variable to the number of proxies we are using, but we just have a regular Galaxy environment (plus for 50% of users we do receive the correct IP), so I am at a loss.
I think I picked this up from this forum a while ago.
I am in AWS with Elastic Beanstalk with an application load balancer. My HTTP_FORWARDED_COUNT is set to 2.
Not sure how the Galaxy stack is built but I would not be amazed if you’d have 3-4 proxies there. But with this I am only saying that I would not be amazed and not that there is a high probability.
I run my own analytics data collection for the logged in users. The way I capture IP is with something like this:
I don’t think the private IPs we are seeing are limited to EU users because I inspected their behavior and they did things that only US-based users would do.