| Matthias Andreas Benkard | 341525c | 2026-11-05 19:12:05 +0100 | [diff] [blame] | 1 | # Middlewares attached to Traefik's entrypoints (see ports.*.http.middlewares |
| 2 | # in traefik/values.yaml). Apply this file before upgrading the Helm release: |
| 3 | # a missing entrypoint middleware breaks every router. |
| 4 | # |
| 5 | # kubectl apply -f traefik/middlewares.yaml |
| 6 | |
| 7 | # Per-client-IP rate limit for all routes (IngressRoutes as well as the |
| 8 | # nginx-class Ingresses). Traefik instantiates entrypoint middlewares per |
| 9 | # router, so the bucket is per IP *and* router, not global per IP. Clients |
| 10 | # over the limit get 429. The cgit per-host cap (mulk/git-cgit-ratelimit in |
| 11 | # git/git.yaml) applies on top of this. |
| 12 | # |
| 13 | # Traefik sits on hostPorts without a proxy in front, so the remote address is |
| 14 | # the real client; X-Forwarded-For is never trusted (depth 0). |
| 15 | apiVersion: traefik.io/v1alpha1 |
| 16 | kind: Middleware |
| 17 | metadata: |
| 18 | name: ratelimit-per-ip |
| 19 | namespace: traefik |
| 20 | spec: |
| 21 | rateLimit: |
| 22 | average: 10 |
| 23 | period: 1s |
| 24 | burst: 100 |
| 25 | sourceCriterion: |
| 26 | ipStrategy: |
| 27 | depth: 0 |
| 28 | # One bucket per IPv6 /64 rather than per address. |
| 29 | ipv6Subnet: 64 |