Skip to content

Usage with Wagtail Personalisation #17

@drcongo

Description

@drcongo

Hello. I'm using Wagtail-Cache on a site that also uses Wagtail-Personalisation which allows different users to see different versions of pages based on segmentation. Obviously I need to cache the segmented versions of the page and serve the correct one to each user, but what I'm getting is whichever version of a page was first matched saved in the cache and then every user seeing that version.

Given that Wagtail-Cache uses vary on cookie, I figured that I should be able to store the segmentation rules that a user matches in a cookie and each page version would then get cached separately, but unfortunately it's still serving the first requested version. I don't know Django's cache mechanisms particularly well, do you know if there are some rules around which cookies the vary checks against?

Plan B is to try overriding Wagtail-Cache's middleware to add checks against segmentation in there but I'd like to keep a clean Wagtail-Cache install if possible.

Thanks, and sorry it's more of a question than an issue.

edit: I've also tried adding a custom x-segmentation header and using patch_vary_headers to add that to the vary list. I'm starting to think this is all just down to the order that things are happening. If I find a solution I'll report back.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions