How can I use Traefik's IP whitelist with Cloudflare as my DNS and CDN?

Question

Grade: Education Subject: Support
How can I use Traefik's IP whitelist with Cloudflare as my DNS and CDN?
Asked by:
71 Viewed 71 Answers

Answer (71)

Best Answer
(519)
To use Traefik's IP whitelist with Cloudflare, you need to configure Traefik to only allow traffic from Cloudflare's IP ranges. First, obtain the current list of Cloudflare IP ranges from their official website (they change periodically). Then, configure Traefik's `entryPoints` section to use an `ipwhitelist` middleware, specifying those Cloudflare IP ranges. Ensure your Cloudflare DNS records point to your Traefik instance. This setup prevents direct access to your server, forcing all traffic through Cloudflare.