Skip to content

Commit 06a354e

Browse files
committed
add traefik bouncer section
1 parent bb38828 commit 06a354e

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

crowdsec-docs/unversioned/bouncers/traefik.mdx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,29 @@ Now, you can install the remediation component:
128128
```bash
129129
kubectl apply -f bouncer-middleware.yaml
130130
```
131+
132+
### Treafik Behind an Upstream Proxy or Load Balancer
133+
134+
When Traefik operates behind another proxy (such as a load balancer, CDN, etc ...), the source IP seen by Traefik may be the wrong one instead of the real client.
135+
To ensure Crowdsec applies decisions correctly based on the real client IP, it's crucial to properly forward and trust headers.
136+
137+
First you configure Treafik to trust the upstream forwarded headers. Traefik has [`forwardedHeaders.trustedIPs`](https://doc.traefik.io/traefik/routing/entrypoints/?utm_source=chatgpt.com#forwarded-headers) and [`proxyProtocol.trustedIPs`](https://doc.traefik.io/traefik/routing/entrypoints/?utm_source=chatgpt.com#forwarded-headers) directives.
138+
139+
140+
Then, you need to configure the middleware to trust as well the IP:
141+
142+
```yaml
143+
spec:
144+
plugin:
145+
bouncer:
146+
forwardedheaderstrustedips: <trusted-cidr>
147+
```
148+
149+
When using `proxyProtocol.trustedIPs` Traefik replaces `X-Real-Ip`, you can also add :
150+
151+
```yaml
152+
spec:
153+
plugin:
154+
bouncer:
155+
forwardedHeadersCustomName: X-Real-Ip
156+
```

0 commit comments

Comments
 (0)