IPAllowList

Limiting Clients to Specific IPs

IPAllowList limits allowed requests based on the client IP.

Configuration Examples

Docker & Swarm

  1. # Accepts connections from defined IP
  2. labels:
  3. - "traefik.tcp.middlewares.test-ipallowlist.ipallowlist.sourcerange=127.0.0.1/32, 192.168.1.7"

Kubernetes

  1. apiVersion: traefik.io/v1alpha1
  2. kind: MiddlewareTCP
  3. metadata:
  4. name: test-ipallowlist
  5. spec:
  6. ipAllowList:
  7. sourceRange:
  8. - 127.0.0.1/32
  9. - 192.168.1.7

Consul Catalog

  1. # Accepts request from defined IP
  2. - "traefik.tcp.middlewares.test-ipallowlist.ipallowlist.sourcerange=127.0.0.1/32, 192.168.1.7"

File (TOML)

  1. # Accepts request from defined IP
  2. [tcp.middlewares]
  3. [tcp.middlewares.test-ipallowlist.ipAllowList]
  4. sourceRange = ["127.0.0.1/32", "192.168.1.7"]

File (YAML)

  1. # Accepts request from defined IP
  2. tcp:
  3. middlewares:
  4. test-ipallowlist:
  5. ipAllowList:
  6. sourceRange:
  7. - "127.0.0.1/32"
  8. - "192.168.1.7"

Configuration Options

sourceRange

The sourceRange option sets the allowed IPs (or ranges of allowed IPs by using CIDR notation).