-
Notifications
You must be signed in to change notification settings - Fork 352
Clarification on cookies in routes: #5486
Description
Priority
3 - Not urgent - can be addressed as team bandwidth permits
Where should the changes be made?
https://developer.upsun.com/docs/routes/cache#cookies
https://developer.upsun.com/docs/routes/cache#example-with-a-single-value
https://developer.upsun.com/docs/routes/cache#example-with-a-regular-expression
https://developer.upsun.com/docs/routes/cache#allowing-only-specific-cookies
What exactly should be updated?
The first three links indicate that including values in the cookies property will create cache keys based on the value of the cookies:
A list of allowed cookies to include in the cache key. All other cookies are ignored.
... the cache key depends on the value of the foo cookie in the request. Other cookies are ignored
This configuration causes all cookies beginning with SESS or SSESS to be part of the cache key, as a single value. Other cookies are ignored for caching.
But the fourth link above says
Some applications use cookies to invalidate cache responses, but expect other cookies to be ignored. This is a case of allowing only a subset of cookies to invalidate the cache
The first three would leave me to believe that unique cache keys are being created for users who has those cookies, and subsequent requests to the same resource will cause the router to serve that cached response. E.g. an authenticated shopper will see a cached copy of their shopping cart.
But the fourth one is confusing given all four links use (essentially) the same config example (see screenshot); the only difference being one is lowercase, the other all uppercase. The description on this fourth link leads me to believe the presence of a listed cookie causes the router to invalidate cache thereby by-passing cache and going straight to the origin/app.
Optional: Additional context
No response