Closed (fixed)
Project:
Preview Link
Version:
2.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
21 Jun 2024 at 11:53 UTC
Updated:
28 Apr 2026 at 06:05 UTC
Jump to comment: Most recent
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.
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.
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
shani mauryaComment #3
shani mauryaComment #4
larowlanThis 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
Comment #5
shani maurya@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!
Comment #6
larowlanI 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.
Comment #7
shani maurya@larowlan the above solutions did not worked.
Comment #8
larowlanComment #10
brayn7 commented.
Comment #12
brayn7 commentedComment #13
acbramley commentedComment #14
acbramley commentedAdded some test coverage for this, not sure if we need more. The test-only pipeline doesn't seem to be working properly but the test does fail on 2.x
Comment #15
larowlanLooks great to me - thanks @acbramley
Comment #17
acbramley commentedThanks everyone