/ReaL IP from Cloudflare

ReaL IP from Cloudflare

3
v1.0.0

cloudflareip

codecov Go Report Card

If Traefik is behind Cloudflare, it won't be able to get the real IP from the external client by checking the remote IP address.

This plugin solves this issue by overwriting the X-Real-IP with an IP from the Cf-Connecting-IP header. The real IP will be the Cf-Connecting-IP if request is come from cloudflare ( truest ip in configuration file).

Configuration

Configuration documentation

Supported configurations per body

SettingAllowed valuesRequiredDescription
trustip[]stringYesIP or IP range to trust

Static

pilot:
token: xxxx
experimental:
plugins:
traefik-real-ip:
modulename: github.com/vincentinttsh/cloudflareip
version: v1.0.0

Dynamic configuration

http:
routers:
my-router:
rule: Path(`/whoami`)
service: service-whoami
entryPoints:
- http
middlewares:
- cloudflareip
services:
service-whoami:
loadBalancer:
servers:
- url: http://127.0.0.1:5000
middlewares:
cloudflareip:
plugin:
cloudflareip:
trustip:
- "1.1.1.1/24"