Preview showing cached version with Varnish in Acquia Cloud

Created on 3 February 2025, 5 months ago

Problem/Motivation

Visitors accessing the site with a preview link are served cached content from Varnish.

Steps to reproduce

Reproduction requires an environment with Varnish configured. This is reproducible in Acquia Cloud.
1) Generate a preview link for a workspace
2) Access the preview link in an incognito or non-logged in browser

You will be served whatever version of the page is cached.

Proposed resolution

Consider having the preview controller set other cookie values / a session cookie to bypass cache.
Recommend VCL configuration that can act on the wse_preview cookie parameter.

🐛 Bug report
Status

Active

Version

2.0

Component

Workspace Preview

Created by

🇺🇸United States jerdavis Minneapolis, MN

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

Merge Requests

Comments & Activities

  • Issue created by @jerdavis
  • 🇫🇮Finland j-vee Turku, Finland

    Had the same issue with Platform.sh

    To fix this, I had to add the cookie wse_preview to the .platform/routes.yaml settings file as per https://docs.platform.sh/define-routes/cache.html

    I'd imagine the solution will be similar for Acquia as well.

    This should be mentioned in the readme somewhere for the future folks.

  • 🇺🇸United States danflanagan8 St. Louis, US

    I have confirmed this buggy behavior on Acquia Cloud with Varnish. If anyone needs an immediate fix, we can always cache bust by adding a random query string to the end of the url. That's a lot to ask of previewers, though, especially if they're going to be clicking around to multiple pages during the preview. But in a pinch!

    I like the idea of starting a session in order to bypass Varnish (or other reverse proxy caches). I made a patch that I tested in an Acquia Cloud dev environment. It seems to have done the trick.

    I'm going to put in an MR. I'm going to start lazy and eschew DI. If the maintainer approves the approach, we could then polish it.

  • 🇺🇸United States danflanagan8 St. Louis, US
  • Pipeline finished with Failed
    3 months ago
    Total: 219s
    #475284
  • Pipeline finished with Success
    3 months ago
    #478012
  • Pipeline finished with Success
    3 months ago
    Total: 175s
    #478301
  • Pipeline finished with Failed
    3 months ago
    Total: 217s
    #479289
  • Pipeline finished with Failed
    3 months ago
    Total: 335s
    #479355
  • Pipeline finished with Canceled
    3 months ago
    Total: 42s
    #480587
  • Pipeline finished with Failed
    2 months ago
    Total: 1166s
    #483957
  • Pipeline finished with Success
    2 months ago
    #490241
  • Pipeline finished with Success
    2 months ago
    #490252
  • Pipeline finished with Canceled
    about 2 months ago
    Total: 237s
    #500595
  • Pipeline finished with Success
    about 2 months ago
    Total: 625s
    #500600
  • Pipeline finished with Success
    about 2 months ago
    Total: 554s
    #500662
  • Pipeline finished with Success
    about 2 months ago
    Total: 873s
    #501468
  • Pipeline finished with Success
    about 2 months ago
    Total: 652s
    #501482
  • Pipeline finished with Failed
    about 1 month ago
    Total: 258s
    #516358
  • Pipeline finished with Canceled
    about 1 month ago
    Total: 86s
    #516359
  • Pipeline finished with Failed
    about 1 month ago
    Total: 203s
    #516360
  • Pipeline finished with Canceled
    about 1 month ago
    Total: 83s
    #516366
  • Pipeline finished with Failed
    about 1 month ago
    #516367
  • Pipeline finished with Failed
    about 1 month ago
    Total: 254s
    #516370
  • Pipeline finished with Failed
    about 1 month ago
    Total: 271s
    #516390
  • Pipeline finished with Success
    about 1 month ago
    Total: 218s
    #516394
  • Pipeline finished with Success
    about 1 month ago
    Total: 152s
    #519604
  • Pipeline finished with Success
    about 1 month ago
    Total: 145s
    #519607
  • Pipeline finished with Success
    15 days ago
    Total: 282s
    #533043
  • Pipeline finished with Success
    15 days ago
    Total: 313s
    #533345
  • Status changed to Needs review 10 days ago
  • 🇺🇸United States danflanagan8 St. Louis, US

    After some testing in the wild, we determined that the caching of the redirect was problematic. We don't want it anywhere in the Drupal cache or the browser cache, otherwise the session might not get started when the user tries the preview link.

  • Pipeline finished with Failed
    10 days ago
    Total: 218s
    #537337
  • Pipeline finished with Success
    5 days ago
    Total: 303s
    #541030
  • Pipeline finished with Success
    5 days ago
    Total: 297s
    #541313
  • Pipeline finished with Skipped
    4 days ago
    #542166
Production build 0.71.5 2024