monicahq/laravel-cloudflare
Laravel middleware that automatically trusts Cloudflare proxy IP ranges so client IPs and forwarded headers are handled correctly. Drop-in replacement for Laravel’s TrustProxies, with an optional callback to customize how proxy lists are loaded.
Cf-Connecting-Ip header support for true client IP resolution).Adopt this package if:
$request->ip() or $request->user()->ip() for critical logic (e.g., geo-restrictions, logging).TrustProxies middleware with a Cloudflare-specific solution that handles IP updates transparently.Look elsewhere if:
TrustProxies behavior.For Executives: "This package automates Cloudflare IP trust management in Laravel, reducing security risks and DevOps costs. By replacing manual IP whitelisting with a self-updating system, we eliminate errors from stale IP lists and ensure compliance with geo-restrictions or rate-limiting rules. It’s a 10-minute setup that future-proofs our infrastructure against Cloudflare’s IP changes—no more fire drills when they rotate IPs. For [use case: e.g., ‘our EU customer base’], this ensures accurate IP-based access controls without manual intervention."
For Engineering:
*"This is a drop-in replacement for Laravel’s TrustProxies middleware, but optimized for Cloudflare. Key benefits:
TrustProxies in bootstrap/app.php, add a cron job for cache refreshes, and optionally publish the config for tuning. Tests show it’s battle-tested across Laravel versions."*For Security/Compliance: *"This ensures our Laravel apps correctly identify client IPs behind Cloudflare, which is critical for:
How can I help you explore Laravel packages today?