-
-
Notifications
You must be signed in to change notification settings - Fork 32k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
X-Forwarded-For is parsed incorrectly / incompletely #29868
Comments
The background for my issue is that I want to make use of |
I had same issue with cloudflare but it's possible to handle header on i.e. nginx proxy. So now I again see client's ip, not cloudflare proxy. |
Hey there @home-assistant/core, mind taking a look at this issue as its been labeled with a integration ( |
@andriej Unfortunately this is not a solution for me, because a) traefik does not allow a dynamic overwrite of the |
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. |
This issue is not stale as the problem is still present. |
I am experiencing the same situation in a similar environment. Home-Assistant is grabbing my external proxy (Nginx) which then routes through Traefik load balancer. |
Same issue here with a similar setup (traefik 2.2). |
🎉 Thank you very much! |
Home Assistant release with the issue:
Home Assistant 0.103.0
Last working Home Assistant release (if known):
none
Operating environment (Hass.io/Docker/Windows/etc.):
Docker
Integration:
https://www.home-assistant.io/integrations/http
Description of problem:
As previously described in #25963 and #26193 at the moment the right-most value from
X-Forwarded-For
is used instead of the left-most value.I understand that there is a trust issue with values on the left, but a solution could be to strip
trusted_proxies
from the right and then use the first non-trusted_proxies
value as the client IP instead. This would allow us to get the IP of the client before the first trusted proxy.Problem-relevant
configuration.yaml
entries and (fill out even if it seems unimportant):Additional information:
10.0.0.1
is my external proxy (reachable from the internet) and10.8.0.0/16
is the internal network of traefik loadbalancers between the external proxy and Home Assistant. An example request header would look like this:Since
10.0.0.1
is a trusted proxy, we could usemy-client-ip
instead of10.0.0.1
as the client IP.I would be willing to implement this if a PR for this would be accepted.
The text was updated successfully, but these errors were encountered: