Router - Rule - ClientIP Not Working

Hello,

I'm attempting to use the ClientIP rule to have traffic from one IP source use a different router. to bypass some middleware. I've removed the other router during troubleshoot and it appears to be down to this rule -

  • traefik.http.routers.example.rule=Host(xyz.example.com) && ClientIP(10.0.0.50)

I get an error 404 when browsing the page. There is no other proxy in the middle that would be obscuring the client's IP address.

I can certainly provide more of my config, but if I was to simply remove the ClientIP portion of this rule, I would access the page without issue.

Any input would be appreciated.

Share your full Traefik static and dynamic config, and docker-compose.yml if used.

I actually found the issue. I identified in the access logs that the source IP was always coming from the docker swarm ingress. I modified my Traefik configuration to use the host network.

For reference, you can set dedicated ports in host mode, see simple Traefik Swarm example:

    ports:
      # listen on host ports without ingress network
      - target: 80
        published: 80
        protocol: tcp
        mode: host
      - target: 443
        published: 443
        protocol: tcp
        mode: host

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.