/Cloudflare

Cloudflare

9
v1.0.0

traefik-cloudflare-plugin

Tag Badge Go Version Badge Build Badge Go Report Card Badge

Traefik plugin to handle traffic coming from Cloudflare.

Features

  • Only allow traffic originating from Cloudflare
  • Rewrite requests X-Forwarded-For header with the user IP

Configuration

Plugin options

KeyTypeDefaultDescription
trustedCIDRs[]string[]Requests coming from a source not matching any of these CIDRs will be terminated with a 403. If empty, it is populated with Cloudflare's CIDRs.
refreshIntervaltime.Duration24hWhen trustedCIDRs is empty, Cloudflare's CIDRs will be refreshed after this duration. Using a value of 0 seconds disables the refresh.
overwriteForwardedForbooltrueWhen true, the request's X-Forwarded-For header is replaced by the content of the CF-Connecting-IP header.

Traefik static configuration

experimental:
plugins:
cloudflare:
moduleName: github.com/Desuuuu/traefik-cloudflare-plugin
version: v1.0.0

Dynamic configuration

http:
middlewares:
cloudflare:
plugin:
cloudflare:
trustedCIDRs: []
overwriteForwardedFor: true
routers:
foo-router:
rule: Path(`/foo`)
service: foo-service
entryPoints:
- web
middlewares:
- cloudflare