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

Log client's “real” IP address in Docker Swarm 1.12 when accessing a service #27143

Closed
eskp opened this issue Oct 4, 2016 · 4 comments
Closed

Comments

@eskp
Copy link

eskp commented Oct 4, 2016

I have nginx container running as a service in Docker Swarm inside user created overlay network. Both created with:

docker network create --driver overlay proxy
docker service create --name proxy --network proxy -p 80:80 nginx

When accessing an nginx site through the browser, in nginx access log remote address is logged as 10.255... formatted address, what I presume to be the Swarm load balancer address. The question is how to know/log the address of the end client accessing the site and not the load balancer address.

@cpuguy83
Copy link
Member

cpuguy83 commented Oct 4, 2016

I've been wondering this as well.
Ping @mrjana

@zas
Copy link

zas commented Oct 5, 2016

Related to #25526

@eskp
Copy link
Author

eskp commented Oct 6, 2016

Thanks @zas. Now watching #25526

@eskp eskp closed this as completed Oct 6, 2016
@struanb
Copy link

struanb commented Mar 7, 2021

We've now released v3.1.0 of https://github.com/newsnowlabs/docker-ingress-routing-daemon, which modifies docker's ingress mesh routing to expose true client IPs to service containers:

  • implemented purely through routing and firewall rules; and so
  • without the need for running any additional application layers like traefik or other reverse proxies; and so
  • there's no need to reconfigure your existing application.

As far as I know, the docker-ingress-routing-daemon is the most lightweight way to access client IPs from within containers launched by docker services.

Summary of features:

  • Support for replacing docker's masquerading with routing on incoming traffic either for all published services, or only for specified services on specified TCP or UDP ports
  • Support for recent kernels (such as employed in Google Cloud images) that set rp_filter=1 (strict) inside service containers
  • Automatic installation of kernel tweaks that improve IPVS performance in production (though this can be disabled)

Please check it out and raise any issues you find.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants