Getting Started
EdgeTrust keeps Laravel's trusted proxy configuration in sync with the IP ranges published by CDN and edge providers. Instead of hard-coding ranges or trusting every request, you enable the providers you use and let EdgeTrust supply validated CIDR lists to Laravel's TrustProxies middleware.
Requirements
- PHP 8.2 or newer
- Laravel 10+, 11, 12, or 13
- Network access from your application (runtime / hybrid modes) or a scheduled sync job when refreshing ranges
Quick start
- Install the package:
composer require hosni/laravel-edge-trust- Enable the providers you terminate TLS with (no config publish required):
# .env
EDGE_TRUST_MODE=hybrid
EDGE_TRUST_PROVIDERS=cloudflareComma-separate multiple keys (cloudflare,aws_cloudfront). Use EDGE_TRUST_PROVIDERS= or * for every registered provider. Default when unset is cloudflare.
Publishing config/edge-trust.php is optional — only needed for nested options (custom provider classes, per-provider min-prefixes, …).
Wire EdgeTrust into Laravel's trusted proxies middleware. EdgeTrust does not silently replace your middleware stack — see Trust Proxies.
Optionally schedule sync (registered automatically when
EDGE_TRUST_SCHEDULE_SYNCis true).
What EdgeTrust does
| Concern | Behavior |
|---|---|
| Source of truth | Official provider IP list endpoints |
| Delivery | Bundled archives, runtime fetches, or hybrid |
| Safety | Validation, checksums, atomic writes |
| Laravel integration | Supplies CIDRs to TrustProxies |
What EdgeTrust does not do
- It does not act as an origin firewall or IP allowlist at the network edge.
- It does not auto-replace middleware without an explicit change in your app.
- It does not fetch remote IP lists on every HTTP request.
Continue with Installation or jump to Configuration.