IP allowlist examples
Sources live under examples/ip-allowlist/.
Internal + specific IPs per host
yaml
# Route-level IP allowlist: only listed sources may reach the host.
# Default (no rules[].waf.allow/deny) stays unrestricted.
version: v1
port: 8080
rules:
- host: admin.example.com
backend:
service:
name: admin-console
port: 8080
protocol: http
waf:
# Per-route WAF must be enabled for the IP phase to run.
enabled: true
# IP-only mode: do not run the built-in attack signatures.
disable_builtin: true
allow:
- 10.0.0.0/8
- 172.16.0.0/12
- 203.0.113.7/32
- host: internal-api.example.com
backend:
service:
name: internal-api
port: 8080
protocol: http
waf:
enabled: true
disable_builtin: true
allow:
- 10.0.0.0/8
- 192.168.0.0/16
# No waf.allow/deny -> unrestricted (unchanged default behaviour).
- host: app.example.com
backend:
service:
name: app
port: 8080
protocol: httpBehind a load balancer (trusted_proxies)
yaml
# Behind a load balancer: trust X-Forwarded-For only from proxy networks.
# The client IP is the rightmost XFF hop that is not itself a trusted proxy.
version: v1
port: 8080
waf:
trusted_proxies:
- 10.0.0.0/8
- 172.16.0.0/12
rules:
- host: admin.example.com
backend:
service:
name: admin-console
port: 8080
protocol: http
waf:
enabled: true
disable_builtin: true
allow:
- 203.0.113.0/24Allow with a denied exception
yaml
# deny wins over allow: block one office IP even though its /24 is allowed.
version: v1
port: 8080
rules:
- host: pay.example.com
backend:
service:
name: pay
port: 8080
protocol: http
waf:
enabled: true
disable_builtin: true
allow:
- 203.0.113.0/24
deny:
- 203.0.113.66/32Exact single IP
yaml
# Exact single-IP allowlist (a bare IP is treated as /32 or /128).
version: v1
port: 8080
rules:
- host: ops.example.com
backend:
service:
name: ops-console
port: 8080
protocol: http
waf:
enabled: true
disable_builtin: true
allow:
- 203.0.113.7Validate
bash
ingress validate -c examples/ip-allowlist/ingress.yamlSee WAF guide for semantics.