# RUM JS not collecting user agent location

**URL:** <https://discuss.elastic.co/t/rum-js-not-collecting-user-agent-location/310993>\
**Category:** User Experience\
**Created:** [July 29, 2022, 2:26pm UTC](https://discuss.elastic.co/t/rum-js-not-collecting-user-agent-location/310993 "2022-07-29T14:26:08Z")\
**Posts on this page:** 1\
**Showing post:** 19

<div class="post-metadata">

**Author:** ![Alberto\_Delgado](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alberto_delgado/32/98488_2.png) [@Alberto\_Delgado](https://discuss.elastic.co/u/Alberto_Delgado)\
**Post date:** [September 20, 2022, 1:58pm UTC](https://discuss.elastic.co/t/rum-js-not-collecting-user-agent-location/310993/19 "2022-09-20T13:58:23Z")

</div>

Hi @marone,

Glad that worked! 😄

> when I did some research on google, found that they use Nginx and they set this header for incoming http request.

Bear in mind this description from [MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For) about **X-Forwarded-For**

"The `X-Forwarded-For` (XFF) header is a de-facto standard header for identifying the originating IP address of a client connecting to a web server through an HTTP proxy or a load balancer. When traffic is intercepted between clients and servers, server access logs contain the IP address of the proxy or load balancer only. To see the original IP address of the client, the `X-Forwarded-For` request header is used."

You need to configure your environment to handle the scenario described above, you cannot do such logic from the client side. (excluding the local modification for testing that you made)

Apart from that, once you start having visitors you will start seeing their regions properly differentiated. Is the website already accessible over the internet?

Please, have a look at this [link](https://discuss.elastic.co/t/private-ip-addresses-are-logged-in-as-client-ip/236531) since might be helpful for you, too.

Thanks,  
Alberto

---

_[View the full topic](https://discuss.elastic.co/t/rum-js-not-collecting-user-agent-location/310993)._
