Key details

  1. Pre-cache Edge Scripting is in public preview.
  2. New client-side request and response hooks can execute around the normal CDN cache path.
  3. The change allows per-request authentication, personalization, rewrites or header logic without automatically disabling CDN caching.
  4. A separate Cache API exposes match, put and delete operations to Edge Scripts.
  5. Script-controlled cache entries are regional rather than globally replicated.
  6. bunny.net documents a 100 MB maximum object size for the Cache API.

What builders should take away

  1. If edge authentication or personalization previously forced you to bypass caching, test the pre-cache hooks before redesigning around origin-side logic.
  2. Use automatic CDN caching when standard HTTP cache semantics are enough; use the Cache API only when your application genuinely needs custom keys, storage or invalidation.
  3. Treat regional cache entries as region-local state and test cross-region behavior explicitly before using them for globally consistent application data.
  4. Model the cost and latency of running a script on every request, not just cache-miss traffic, because pre-cache logic changes the execution path on hits as well.
  5. Keep preview-dependent code isolated behind a small edge abstraction so limits or semantics can be changed without rewriting the application.

What changed

bunny.net has put new Edge Scripting cache controls into public preview. Developers can now run client-request and client-response hooks before and around the normal CDN cache path, rather than having Edge Scripts skipped when a cached response is served. A separate Cache API gives scripts explicit match, put and delete operations for a regional cache. Together, the changes allow per-request logic such as authentication, personalization or request rewriting without automatically forfeiting edge caching.

Why it matters

The previous execution model forced an architectural trade-off: logic that had to run on every request could conflict with the CDN’s cheapest and fastest path because cache hits could bypass the script. Pre-cache execution lets builders keep dynamic control at the edge while preserving automatic caching, and the Cache API adds a lower-level option for application-managed cache behavior. That can simplify authenticated content, feature flags, routing, API acceleration and personalized responses, but it also moves cache correctness into application logic when developers opt into the explicit API.

Pre-cache hooks change where edge code sits in the request path

bunny.net says the new onClientRequest and onClientResponse hooks execute before and after cache handling on the client side of the edge request. That means a script can inspect or modify a request before the CDN looks for a cached object and can alter the response on its way back to the client. Builders can therefore apply authentication, headers, rewrites or personalization logic on every request while still allowing the underlying content to benefit from bunny.net’s automatic CDN cache.

The Cache API is a separate application-controlled cache

The preview also adds script-level cache.match(), cache.put() and cache.delete() operations. This cache is regional rather than globally replicated and uses exact cache keys, giving developers explicit control over what is stored and invalidated. bunny.net documents a 100 MB per-object limit, so the API is better suited to application responses and derived data than arbitrarily large assets.

Automatic caching and script caching solve different problems

Pre-cache execution is useful when the existing CDN cache should remain authoritative but request-specific logic must always run. The Cache API is useful when the script itself needs to decide what constitutes a hit, how keys are formed, or when an object is replaced. Using the latter means developers also own more of the invalidation and consistency logic, especially because cache contents are regional rather than a single globally synchronized store.

Public preview means architecture should keep an escape hatch

The capability is available as a public preview rather than a settled GA contract. Teams can use it to test edge-auth, personalization and API-cache patterns, but should monitor execution pricing, limits and semantics before making it a hard dependency. Region-local cache behavior also deserves explicit testing for applications that assume immediate global consistency after writes or deletes.

What to watch next

  • General-availability timing and any changes to Edge Scripting execution pricing or limits.
  • Whether bunny.net expands the Cache API from regional storage to broader replication or adds stronger invalidation primitives.
  • Production guidance for cache consistency, eviction and observability.
  • Additional hooks or APIs that allow scripts to influence cache keys and stale/revalidation behavior more directly.

Still unclear

  • The new cache controls are still in public preview and may change before general availability.
  • bunny.net’s announcement is the primary evidence for the capability; there is not yet substantial independent production testing of latency or cost effects.
  • Regional Cache API behavior means application-level consistency depends on where requests execute, which may matter for some stateful uses.

Sources

Direct reading behind this dossier.

1 sources