I´m trying to set up that Traefik 1.7.12 is forwarding Headers X-Forwarded-For and X-Real-Ip with the origin Client IPs. Network in between is a Docker "driver: bridge" net. The only IP which I can see with Wireshark is the gateway IP x.x.x.1 of the Docker Network itself. What is wrong here? Any help is really appreciated.
Here are some snippets out of the traefik compose file, traefik.toml and docker-compose.yml of an web app (nginx) behind the proxy.
Thank you for the hint! But, I don’t want to install Docker swarm as a Single Node Cluster for getting correct client IPs into the Header. It’s a bit like taking a sledgehammer to crack a nut.
Is there really no other workaround out there at the moment. What’s about Traefik 2.0? Is there the same constraint in common with Docker without swarm?
As far as I understand the advice James give is generic, it is not specific to swarm. It's just that examples given there are for swarm, but you should be able to do the same without.
Thanks zespri! As I understand, host mode in a non docker swarm can't be used with containers which are in docker networks.
In swarm mode, host mode hasn't this constraint, because there is a additional overlay network which connects host network as well towards containers in docker networks. But, there are other constraints in terms of high availability.
Can you point me to where you get this from. I skimmed through the link you gave, and even searched for "host" on that page, but could not find anything that would indicate it. Of course on swarm the host mode is trickier, because there is more than one host - that's what that link says, but that certainly should not preclude single-host no-swarm setup.
At stackoverflow "Traefik as a proxy for Docker container with host machines network" user BMitch replies with "Without a common docker network, traefik won't be able to route to your container."
Regarding swarm mode constraints this will be discussed at before posted Worp.one link.
Quora.com link explains differences between docker-compose and swarm in general.
Okay, now I see where you're going with this. Basically it will work with host mode, but then all containers have to be run in host mode I guess and that's simply not possible in a complex docker environment. With swarm this would work, because you can still use docker networks with the Traefik running in host mode. But as already written I don't want to use swarm on a single host, because in my eyes this is a sledgehammer method and brings unnecessary complexity to - KISS - keep it stupid simple.
I don't think it's a bug per se, we just explored, how this happening above. That's just how the networking infrastructure built.
Traefik cannot inject this header, because it does not have access to the source IP. Docker cannot inject this header because it's not working with HTTP(s) protocol at all it has no visibility to these headers on the network layer. Do we have to assign blame?
I understand the background a little better now, thank you. So it's not a bug, but rather a limitation, or rather a missing possibility in today's technical standards.
Maybe it helps to think laterally. What about the 2.0 version? Can it also handle pure TCP routing? If yes, you could start here, if not it would be maybe useful to push this further.
My point here is in the least to accuse anyone. For me it is only important to communicate clearly what is possible and what is not, so that you don't end up in a dead end and in the worst case if you have already invested weeks or months in time.
Hi there, since this is the first hit on google, I wanted to ask again if there is still no solution to this?
I also use a single host docker machine with a lot of containers that are reachable via traefik. They all have their own docker networks (e.g. one for my private cloud, one for home automation, etc.). Using traefik in network mode host would completely break that and I'd have to expose all my services on my docker machine that I just managed to secure via authelia.
All my logs are more or less useless (because I only see the docker gateway IP) and I really would like to use projects like crowdsec.
The last entry here is from two years ago. Is there still no solution?