Do not create a session if multiple entity support is disabled - impacts CDN hit rate

Created on 21 June 2024, 5 months ago
Updated 12 July 2024, 4 months ago

Problem/Motivation

I have enabled varnish and preview links on my site. And the varnish cache is working perfectly.

But when I create a preview link and when the preview link page loads, it sets a session cookie, which causes Varnish cache misses. And in a result other page performance decreases.

Steps to reproduce

Setup the varnish. Check varnish should be working.
Enable the Preview link module and generate the preview link for a node.
Hit the link in incognito and then open the other URL of site.
You will notice the page takes time to load and the varnish is also miss.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

2.1

Component

Code

Created by

🇮🇳India Shani Maurya Mumbai

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

Comments & Activities

  • Issue created by @Shani Maurya
  • 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

    This powers the multiple entity support
    We could theoretically remove it if you opted out of multiple entity support
    However is caching preview links a good idea? You wouldn't want to cache drafts viewed by an admin

  • 🇮🇳India Shani Maurya Mumbai

    @larowlan We use preview links only for Node entities. When we open the preview link of any node in any browser and visit the other page of the site, the site is very slow which is causing more issues for us.

    Session cookies get stored for preview links which causes the varnish miss cache.

    We are okay to cache the preview links page. Can you help me with how I can disable the session cookies?

    thank you!

  • 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

    I mean it's hacky, but you could try putting this in the footer of your page in the meantime.

    <img src="/preview-link/session-tokens/remove" height="1" width="1"/>

    Preview link should still work if you're not making use of the 'multiple entities' functionality.

    We need to fix it properly by preventing creating a session if 'multiple entities' is not enabled.

  • 🇮🇳India Shani Maurya Mumbai

    @larowlan the above solutions did not worked.

Production build 0.71.5 2024