hubex-arenti
hubex-arenti

Reputation: 1

Requests coming to my Traefik container all have dockers 172.18.0.1 ip. How can i get the real ip of client?

I am running docker rootless 27.5.1. The whole machine is a VM with Ubuntu server running in vmware esxii.

I have traefik as a reverse proxy in a container . Problem is every request that comes in my proxy has the ip 172.18.0.1 which is that of docker router. How can i solve this i want to get real ip of client because i need it for middlewares in traefik but also without compromising security like doing network in host mode(which didnt work aswell)? This is such a big problem online and i still didnt find a real solution to this.

docker-compose:

services:
    reverse-proxy:
        image: traefik:v3.3
        restart: always
        container_name: traefik
        labels:
            - traefik.enable=false  # Prevents Traefik from discovering itself
        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/

part of traefik.yml:

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"

Things i tried and didn't work:

macvelan network network mode host + publishing ports of container different configurations in traefik for getting info from headers. Please ask me if you need more info from me.

Upvotes: 0

Views: 34

Answers (0)

Related Questions