Skip to content

Latest commit

 

History

History
59 lines (47 loc) · 1.62 KB

README.md

File metadata and controls

59 lines (47 loc) · 1.62 KB

traefik-real-ip-plugin

Tag Badge Go Version Badge Go Report Card Badge

Traefik plugin to retrieve client IPs. Supports retrieving the IP from and writing the result to arbitrary headers.

If a depth or a list of excluded CIDRs is specified, the header is parsed with the same format as the X-Forwarded-For header (1.2.3.4, 1.2.3.5, ...). Otherwise, the entire header is parsed as an IP.

The first valid IP retrieved is written to the configured destination headers.

Traefik static configuration

experimental:
  plugins:
    realip:
      moduleName: github.com/Desuuuu/traefik-real-ip-plugin
      version: v1.1.0

Dynamic configuration

Depth

http:
  middlewares:
    realip:
      plugin:
        realip:
          retrievers:
            - header: X-Forwarded-For
              depth: 1
          headers:
            - X-Real-IP

Excluded CIDRs

http:
  middlewares:
    realip:
      plugin:
        realip:
          retrievers:
            - header: X-Forwarded-For
              excludedCIDRs:
                - "203.0.113.195/24"
          headers:
            - X-Real-IP