Skip to content
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

Unable to get client IP when running on overlay network #614

Open
marccampbell opened this issue Aug 12, 2016 · 17 comments
Open

Unable to get client IP when running on overlay network #614

marccampbell opened this issue Aug 12, 2016 · 17 comments
Labels
area/provider/docker kind/bug/possible a possible bug that needs analysis before it is confirmed or fixed.

Comments

@marccampbell
Copy link

This may be an issue with Docker overlay networks and not Traefik specifically.

When running traefik as a docker 1.12 service and exposing a port, it connects to both the specified network from the service file and the built-in ingress network. When the upstream service receives requests forwarded from Traefik, the X-Forwarded-For header contains an IP address from the overlay network, not the actual client address.

@osixia
Copy link

osixia commented Sep 17, 2016

May be related to:
kubernetes/kubernetes#10921

this is what i get on my kubernetes cluster via emilevauge/whoami image:
https://api.osixia.net/user/whoami

Hostname: whoami-1929362576-lm19i
IP: 127.0.0.1
IP: ::1
IP: 10.244.63.10
IP: fe80::42:aff:fef4:3f0a
GET / HTTP/1.1
Host: api.osixia.net
[...]
Dnt: 1
Upgrade-Insecure-Requests: 1
X-Forwarded-For: 10.244.12.1
X-Forwarded-Host: api.osixia.net
X-Forwarded-Proto: https
X-Forwarded-Server: traefik-3278890820-a3rja

10.244.63.10 is the pod IP
10.244.12.1 is the ip of the node running kube-proxy that accept ingress trafic

No information about the client IP :(

@Starefossen
Copy link
Contributor

I am experiencing the same behaviour when working with Kubernetes and Træfɪk locally through Minikube.

@Starefossen
Copy link
Contributor

I had some hopes that the Kubernetes v1.4 would solve this; ref http://kubernetes.io/docs/user-guide/load-balancer/#loss-of-client-source-ip-for-external-traffic. But so far I have not had any success.

@osixia
Copy link

osixia commented Sep 27, 2016

I now run kubernetes 1.4.0 and nothing changed :(

@emilevauge
Copy link
Member

Ping @vdemeester, any idea on this?

@rio
Copy link
Contributor

rio commented Oct 12, 2016

Just ran in to this today while slowly moving away from our old load balancing infra.
Solution for us was to use an external load balancer to send traffic to NodePorts for the service... not ideal.

@Starefossen
Copy link
Contributor

@rio are you using Træfik at all in your setup?

@rio
Copy link
Contributor

rio commented Oct 12, 2016

Yes, we plan use it as our main ingress point. We've been already using it for services like grafana, staytus and other services that are not dependent on source ip.

@viet
Copy link

viet commented Nov 20, 2016

I still need this new feature, because I run a startup that provides TCP connection only for Minecraft players, there's no IP forwarding via HTTP header. Getting users IP via network layer is always better.

@tzapu
Copy link

tzapu commented Mar 1, 2017

i think this should be possible now using
--publish mode=host,target=80,published=80
and maybe --global

i however was unable to access traefik when publish is set to mode=host...

@vdemeester vdemeester removed their assignment Mar 10, 2017
@ldez ldez added kind/bug/possible a possible bug that needs analysis before it is confirmed or fixed. and removed investigation-needed labels Jun 2, 2017
@farko88
Copy link

farko88 commented Mar 20, 2019

any update for this?

@mbrucher
Copy link

Noticed the same problem, spent several weeks figuring out this problem!!

@samip5
Copy link
Contributor

samip5 commented Feb 11, 2021

This is present on non-kubernets deployments.

@georg90
Copy link

georg90 commented Jul 21, 2021

I am wondering why this is not getting more interest. Any swarm cluster is (IMHO) not usable with traefik..
We can route and forward but we do not know where the request came from, this kills the traefik own ipWhitelist feature as well as anything in the backend (e.g. fail2ban).

Did anybody manage to work around this issue? Currently I am split between using host mode and having the ip but loosing the ingress network or having no option to limit access by source address / exposing the client ip to my apps (e.g. adguard would be much more useful with client IP)

@CumpsD
Copy link

CumpsD commented Apr 14, 2023

I am trying to figure this out as well. I have downstream DNS services and they all receive the IP of the traefik instance, while I need the IP of the client

@munrad
Copy link

munrad commented Apr 16, 2023

Maybe this solution will help in some way
newsnowlabs/docker-ingress-routing-daemon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/provider/docker kind/bug/possible a possible bug that needs analysis before it is confirmed or fixed.
Projects
None yet
Development

No branches or pull requests