Cloudflare Proxy & X-Forwarded-For / Client IP Issue

Howdy @Heavensong89, welcome to the Caddy community.

I think this is your issue. You can’t specify multiple trusted_proxies in this manner - I believe only the latest would apply. That means you’ve overridden your cloudflare trust with private ranges, making Cloudflare untrusted again.

A quick search found this post: Multiple trusted_proxies directives - #2 by francislavoie

Which links to this module: GitHub - fvbommel/caddy-combine-ip-ranges: IP prefix module for Caddy that combines the output of other IP prefix modules.

You should be able to use that to combine the static and cloudflare IP source modules together.

3 Likes