coderedcorp / coderedcorp/wagtail-cache
Usage with Wagtail Personalisation
- Dominant language
- Python
- Stars
- 90
- Forks
- 30
- PR merge metrics
- No merged PRs in 30d
Description
Hello. I'm using Wagtail-Cache on a site that also uses [Wagtail-Personalisation](https://github.com/wagtail/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.
Contributor guide
Assessment
This issue has not been assessed yet.