bynk.http.cache_public_reads_cookies
Error A @cache(scope: public) handler takes a cookies parameter, so a shared cache could replay one user's response to another.
scope: public lets a shared cache, such as a CDN, store the response and serve it to anyone who asks for the URL. A handler that reads cookies answers for whoever is asking, so a shared cache could replay one user's response to another. Use scope: private, the default, which only the user's own browser may keep, or drop the cookies parameter. A response that sets a cookie is always sent as private.
Example
type Session = { sid: Option[String] }
@cache(maxAge: 5.minutes, scope: public) // ✗ the answer depends on who askson GET("/me") (cookies: Session) -> Effect[HttpResult[String]] by v: Visitor { … }
@cache(maxAge: 5.minutes, scope: private) // ✓In the Book
See also
- The grammar rule it governs:
http_handler. - Every code in its category, HTTP, on the diagnostic index.
bynk explain bynk.http.cache_public_reads_cookiesshows the same from the installed toolchain, without a network.