IPWhiteList

Limiting Clients to Specific IPs

IPWhiteList accepts / refuses connections based on the client IP.

Warning

This middleware is deprecated, please use the IPAllowList middleware instead.

Configuration Examples

Docker

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

Kubernetes

  1. apiVersion: traefik.io/v1alpha1
  2. kind: MiddlewareTCP
  3. metadata:
  4. name: test-ipwhitelist
  5. spec:
  6. ipWhiteList:
  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-ipwhitelist.ipwhitelist.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-ipwhitelist.ipWhiteList]
  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-ipwhitelist:
  5. ipWhiteList:
  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).