Open
Description
Summary
Currently, only some hardcoded variables are used when creating cache keys: prefix, site id, path, timezone. Please also respect the Vary header from the response.
Expected behaviour
When adding a vary header, e.g. "Host", it is recognized in the cache key creation, so each request with a different "Host" has a different cache entry.
Actual behaviour
The "Vary" header is not checked, so all requests even with differing headers have the same response.
This behaviour makes it inconsistent between pages in django cms and custom views that are inserted in urls.py before the cms.
Environment
- Python version: 3.5.2
- Django version: 1.9.10
- django CMS version: 3.3.3
I currently have to monkeypatch the behaviour that I need like this:
from cms.cache import page
def monkeypatch_cms_cache_key_function(func):
def cache_key_function_with_host(request):
return func(request) + ":" + request.META.get('HTTP_HOST')
return cache_key_function_with_host
page._page_cache_key = monkeypatch_cms_cache_key_function(page._page_cache_key)