custom-components / authenticated

A platform which allows you to get information about sucessfull logins to Home Assistant.
MIT License
82 stars 28 forks source link

Platform only detects local IP addresses #70

Closed heisenberg2980 closed 3 years ago

heisenberg2980 commented 3 years ago

Version of the custom_component 21.3.0 (installed using HACS)

Describe the bug This platform works fine reporting the IP address when I connect to HA from my local network (IP 192.x.x.x or 172.x.x.x) but it doesn´t update the IP address when I connect to HA from an external IP (i.e. using the phone with mobile data instead of wifi)

log

Not sure how to get the logs from this Platform, but happy to include them if someone tells me how to get them
ludeeus commented 3 years ago

Then you are using a proxy and have have misconfigured your http integration, this just reads the data that HA gets. https://www.home-assistant.io/integrations/http/

heisenberg2980 commented 3 years ago

Then you are using a proxy and have have misconfigured your http integration, this just reads the data that HA gets. https://www.home-assistant.io/integrations/http/

EDIT: You are right, I have connected to HA using my phone and I can see the hostname is "core-nginx-proxy.local.hass.io", so I guess one of my HA addons (nginx) is a proxy, now I need to investigate how to get the real IP address, but thank you!!

I am not using a proxy and haven´t configured the http integration (according to the instructions in the link you provide "You only need to add this to your configuration file if you want to change any of the default settings.")

DavidFW1960 commented 3 years ago

I am not using a proxy and haven´t configured the http integration (according to the instructions in the link you provide "You only need to add this to your configuration file if you want to change any of the default settings.")

You need x_forwarded_for: true and to configure a trusted_proxy in the http section. NGINX also needs to be configured to pass through the x_forwarded_for header which will reveal the true IP address.

heisenberg2980 commented 3 years ago

I am not using a proxy and haven´t configured the http integration (according to the instructions in the link you provide "You only need to add this to your configuration file if you want to change any of the default settings.")

You need x_forwarded_for: true and to configure a trusted_proxy in the http section. NGINX also needs to be configured to pass through the x_forwarded_for header which will reveal the true IP address.

Thanks, after applying the changes it works!!