Skip to content

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 ​

  1. Install the package:
bash
composer require hosni/laravel-edge-trust
  1. Enable the providers you terminate TLS with (no config publish required):
ini
# .env
EDGE_TRUST_MODE=hybrid
EDGE_TRUST_PROVIDERS=cloudflare

Comma-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, …).

  1. Wire EdgeTrust into Laravel's trusted proxies middleware. EdgeTrust does not silently replace your middleware stack — see Trust Proxies.

  2. Optionally schedule sync (registered automatically when EDGE_TRUST_SCHEDULE_SYNC is true).

What EdgeTrust does ​

ConcernBehavior
Source of truthOfficial provider IP list endpoints
DeliveryBundled archives, runtime fetches, or hybrid
SafetyValidation, checksums, atomic writes
Laravel integrationSupplies 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.

Released under the MIT License.