Skip to content
Playground(another site)

bynk.cloudflare.edge_cache_public_authenticated

Error In a context with EdgeCache, a @cache(scope: public) route is served by an actor that authenticates; its response would be shared at the edge with every caller.

In a context with EdgeCache, the edge keys a response by its URL alone, and scope: public lets it share one response with every later caller. On a route whose actor authenticates, such as a Bearer one, that response belongs to one caller, so it would be served to the rest. Use scope: private, which is never shared at the edge, or serve the route by Visitor. See also bynk.http.cache_public_reads_cookies.

Example

type MemberId = opaque String
actor Member { auth = Bearer(secret = "AUTH_SECRET"), identity = MemberId }
@cache(maxAge: 5.minutes, scope: public)
on GET("/me") () -> Effect[HttpResult[String]] by m: Member { … } // ✗ one member's response, shared with all
@cache(maxAge: 5.minutes, scope: private) // ✓
on GET("/me") () -> Effect[HttpResult[String]] by m: Member { … }

In the Book

See also

  • Every code in its category, Cloudflare, on the diagnostic index.
  • bynk explain bynk.cloudflare.edge_cache_public_authenticated shows the same from the installed toolchain, without a network.