Skip to content

Hybrid Mode ​

Hybrid mode prefers fresh runtime data and falls back to bundled archives when a live source cannot be used safely.

php
'mode' => env('EDGE_TRUST_MODE', 'hybrid'),

Resolution order (per provider) ​

  1. Return cached ranges if the cache entry is still valid
  2. Attempt a runtime fetch from the official (or configured) source
  3. Validate the payload (non-global, non-empty, checksum rules)
  4. On success: store in cache (and optionally refresh local archive via sync)
  5. On failure: use the bundled / last-known-good archive for that provider

Failure scenarios ​

ScenarioHybrid behavior
Provider HTTP timeoutFall back to archive
Invalid CIDR in responseFall back to archive; do not cache bad data
Global range in responseFall back to archive
Empty responseFall back to archive
Cache warmServe cache; no fetch

Operational guidance ​

  • Keep archives reasonably fresh with a daily edge-trust:sync even in hybrid mode, so fallbacks are not weeks out of date.
  • Monitor sync failures — silent prolonged fallback means ranges may lag provider changes.
  • Pair hybrid mode with origin firewall allowlisting so temporary archive lag does not become an open proxy trust issue at the network layer.

Compared to other modes ​

  • Stricter offline posture → use bundled
  • No archive fallback desired → use runtime (accept outages impacting refresh)
  • Default recommendation for production behind a CDN → hybrid

Released under the MIT License.