Changes between Initial Version and Version 1 of Ticket #19649
- 01/21/2013 01:17:41 PM (2 years ago)
initial v1 1 1 The cookie storage backend for contrib.messages does not set Vary: Cookie on the response, which means that (in the absence of CSRF protection or sessions or other bits of Django that are likely to set Vary: Cookie) it is possible for users behind a cache to miss messages intended for them, or even for a cache to store a page with a message intended for a single user on it and then serve that page to other users. 2 2 3 In practice, it is quite likely that the cookie message store is used along with CSRF protection or contrib. messages, in which case Vary: Cookie will be set on most responses anyway, rendering this issue moot. 3 In practice, it is quite likely that the cookie message store is used along with CSRF protection or contrib., in which case Vary: Cookie will be set on most responses anyway, rendering this issue moot. 4 4 5 5 A case could be made that the correct fix here is at an even deeper level; that any access of request.cookies should automatically trigger Vary: Cookie on the response. This follows the same logic as the current behavior of SessionMiddleware to set Vary: Cookie on any response where the session is accessed, but pushes that logic down to the common cookie layer where it really belongs, rather than duplicating it in the cookie message storage. If you are accessing cookies at all on the server side, presumably that means you are making some decision based on the cookie that might affect the response in some way, and if so Vary: Cookie must be set or the response might be cached incorrectly.