Hello, ive been stuck on this problem for a few days now. I also saw similar questions but none of the solutions worked.
I have a traefik instance running in a docker container. The problem is i want to implement middleware but none of them work because all of the requests come with the ip 172.18.0.1 which is the dockers ip.
I tried installing several plugins for finding real ips, switching the container to host mode, different configurations in static conf for traefik headers etc.
Any help would be appreciated!
docker-compose:
reverse-proxy:
image: traefik:v3.3
restart: always
container_name: traefik
labels:
- traefik.enable=false
ports:
- "80:80" # http
- "443:443" # https
- "8080:8080" # dashboard
volumes:
- /run/user/1000/docker.sock:/var/run/docker.sock
- ./conf/traefik_config/traefik.yml:/etc/traefik/traefik.yml
- ./conf/certs:/etc/traefik/certs
- ./conf/dynamic:/etc/traefik/dynamic/
- ./conf/letsencrypt/:/etc/letsencrypt/
revelant parts of static:
entryPoints:
web:
address: ":80"
websecure:
address: ":443"
traefik:
address: ":8080"
experimental:
plugins:
traefik-get-real-ip:
moduleName: "github.com/Paxxs/traefik-get-real-ip"
version: "v1.0.3"
traefikrealip:
moduleName: "github.com/NenoxAG/traefikrealip"
version: "v0.0.3"
scanblock:
moduleName: "github.com/safing/scanblock"
version: "v1.0.0"
traefik-real-ip-plugin:
moduleName: "github.com/Desuuuu/traefik-real-ip-plugin"
version: "v1.1.0"
Output from one of the plugins:
traefik | [get-realip] ☃️ Config loaded.(4) &{[{X-From-Cdn cdn1 X-Forwarded-For false} {X-From-Cdn cdn2 Client-Ip false} {X-From-Cdn cdn3 Cf-Connecting-Ip true} {* RemoteAddr false}]}
traefik | [get-realip] 🐸 Current Proxy:(*)
traefik | [get-realip] 👀 IPs:'[172.18.0.1]' 1
traefik | [get-realip] currentIP:172.18.0.1, index:0, result:172.18.0.1