Warm dynamic page cache for authenticated users

Created on 1 February 2021, about 4 years ago
Updated 6 March 2025, about 1 month ago

Problem/Motivation

Hi!

First of all, thanks for this great module! I'm able to keep my rather large site blazingly fast for anonymous users with the sitemap / CDN warmer.

What I would like to do next is to improve the site performance by warming the dynamic page cache for authenticated users. Basically I'm thinking of crawling through the sitemap first as an anonymous users to warm the page cache (this is already in place with the sitemap warmer) and once that is complete, again as an authenticated user. The second pass would warm the dynamic page cache for authenticated users (for those elements that are not role specific).

So my question is: If I would like to write a cache warmer plugin that is a copy of the sitemap plugin but so that it actually crawls the URLs as an authenticated user, how could I make the crawler aware of the session?

Cheers,
Markus

Feature request
Status

Active

Version

2.0

Component

Code

Created by

🇫🇮Finland masipila

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇦🇹Austria daniel.pernold

    Hi all together,

    I have a ready to use Warmer Plugin which uses the mechanism from "drush user:login" with a one time token and subsequent requests with cookie-jar context implementation. It's pretty much the same as the CDN implementation, with one restriction: it accepts only paths with a fixed base URI (scheme and domain), not full URLs.

    It is ready to be contributed. Let's discuss a proper name. What about these suggestions?

    * warmer_backend
    * warmer_login
    * warmer_authenticated

    Any suggestions?

    Cheers,
    Daniel

  • 🇦🇹Austria daniel.pernold

    Another approach, which I found very interesting, is from this repository (but seems unfinished).

    In short: they try to use an EventSubscriber on every request for checking a unique token from a cookie value and the account_switcher to get the user session.

    The warmer itself is just requesting urls with the token in that cookie.

    Advantage: one does not need a "preflight" login request for every user.

    Disadvantage: security concerns since it is kind of an alternative session handling (for every request). Any performance impacts? Cannot tell...

    https://github.com/iqual-ch/authenticated_cache_warmer

  • 🇷🇺Russia kazah

    Can we warm (cache) ajax requests?
    For example webform dialog?

Production build 0.71.5 2024