Closed
Description
Problem Solved By The Feature
If you want to cache a page in different variants on the server side, e.g. a variant for logged-in and non-logged-in users, or for different viewports, this cannot be implemented with one cache per URL.
In such scenarios, the page cached in another variant would lead to a content shift or flickering when loading the page.
Solution
Provide a factory method that allows to modify the key used to store the cache.
For example:
const isr = new ISRHandler({
indexHtml,
invalidateSecretToken: process.env['INVALIDATE_TOKEN'] || 'MY_TOKEN',
enableLogging: false,
cacheKeyFactory: (req: Request) => {
if (req.cookies && req.cookies.access_token) {
return `${$req.url}%authenticated`;
}
return req.url;
}
});
Metadata
Metadata
Assignees
Labels
No labels