|
In the traefik access logs and the dokploy requests page all my requests are logged as coming from the IP 10.0.2.1 which is the address for the docker_gwbridge. I want to know if there is a way to log actual ip's so i can configure traefik to only allow access from certain IP ranges? |
Replies: 1 comment
|
Hi @DerpBoy77! I'm Dosu and I'm helping the Dokploy team. The To get real client IPs, edit entryPoints:
web:
address: ':80'
forwardedHeaders:
trustedIPs:
- "10.0.0.0/8"
- "172.16.0.0/12"
- "192.168.0.0/16"
websecure:
address: ':443'
http3:
advertisedPort: 443
http:
tls:
certResolver: letsencrypt
forwardedHeaders:
trustedIPs:
- "10.0.0.0/8"
- "172.16.0.0/12"
- "192.168.0.0/16"Then restart the Important caveat: If Docker's NAT layer has already stripped the original IP before Traefik receives the request (which can happen especially with IPv6), Once real IPs are showing up, you can restrict access by IP using Traefik's http:
middlewares:
ip-filter:
ipAllowList:
sourceRange:
- "203.0.113.0/24"
- "198.51.100.50"Then reference To reply, just mention @dosu. Docs are dead. Just use Dosu. |
Hi @DerpBoy77! I'm Dosu and I'm helping the Dokploy team.
The
10.0.2.1you're seeing is because of how Docker Swarm routes ingress traffic throughdocker_gwbridgebefore it reaches Traefik, and the default Dokploy-generatedtraefik.ymldoes not include anyforwardedHeadersconfiguration on the entrypoints [1].To get real client IPs, edit
/etc/dokploy/traefik/traefik.ymland addforwardedHeadersto both entrypoints: