I've got a pretty complex webapp based on Django 1.11.
Some time ago users started reporting that they are getting 'someone else's views' - memcached provided them with html cached by decorator @cache_page(xx)
without distinguishing between sessions within the cache grace period.
Upon further investigation, I discovered that in some cases Vary: Cookie
header was missing and wrong 'session' was served. What's strange, it only showed when querying backend with curl (which has no session, user etc -> backend served logged in cached view).
Unfortunately, this issue is really hard to reproduce, sometimes it occures, sometimes it doesn't. I even build a simple Django app from scratch to see if I could check what is the cause.
What was observed, is that the issue does not occur when @cache_page
is removed or login_required
is added .
I ended up removing all @cache_page decorators from views and the issue was not observed on production since but it's a workaround and I would like to know what is the cause.
If anyone has any hint what could be the cause, it would be greatly appreciated!