Preview showing cached version with Varnish in Acquia Cloud

Created on 3 February 2025, 4 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
    about 2 months ago
    Total: 219s
    #475284
  • Pipeline finished with Success
    about 2 months ago
    #478012
  • Pipeline finished with Success
    about 2 months ago
    Total: 175s
    #478301
  • Pipeline finished with Failed
    about 2 months ago
    Total: 217s
    #479289
  • Pipeline finished with Failed
    about 2 months ago
    Total: 335s
    #479355
  • Pipeline finished with Canceled
    about 2 months ago
    Total: 42s
    #480587
  • Pipeline finished with Failed
    about 1 month ago
    Total: 1166s
    #483957
  • Pipeline finished with Success
    about 1 month ago
    #490241
  • Pipeline finished with Success
    about 1 month ago
    #490252
  • Pipeline finished with Canceled
    21 days ago
    Total: 237s
    #500595
  • Pipeline finished with Success
    21 days ago
    Total: 625s
    #500600
  • Pipeline finished with Success
    20 days ago
    Total: 554s
    #500662
  • Pipeline finished with Success
    20 days ago
    Total: 873s
    #501468
  • Pipeline finished with Success
    20 days ago
    Total: 652s
    #501482
Production build 0.71.5 2024