--
Ticket URL: <https://code.djangoproject.com/ticket/32212>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Old description:
> To specify the cache mode, i use the view decorator like this:
> {{{
> @vary_on_headers('Accept', 'Accept-Language', 'Origin', 'User-Agent')
> @cache_control(public=True, max_age=3600)
> }}}
> But after tracing, I found that SessionMiddleware modified the Vary
> Header and added a Cookie, as follows:
> {{{
> if accessed:
> patch_vary_headers(response, ('Cookie',))
> }}}
> Causes cache invalidation after user login again.
> I have specified the cache as public, in which case the cache scheme
> should have nothing to do with cookies.
New description:
To specify the cache mode, i use the view decorator like this:
{{{
@vary_on_headers('Accept', 'Accept-Language', 'Origin')
@cache_control(public=True, max_age=3600)
}}}
But after tracing, I found that SessionMiddleware modified the Vary Header
and added a Cookie, as follows:
{{{
if accessed:
patch_vary_headers(response, ('Cookie',))
}}}
Causes cache invalidation after user login again.
I have specified the cache as public, in which case the cache scheme
should have nothing to do with cookies.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/32212#comment:1>
* status: new => closed
* resolution: => wontfix
Comment:
I'm afraid this is as-designed. It's just how session middleware works.
See #3586 for the change implementing the current behaviour.
If you need hard caching here then serve the "static" pages from a
separate app, without Session middleware, and use JavaScript to load the
user-specific sections.
--
Ticket URL: <https://code.djangoproject.com/ticket/32212#comment:2>