Fixed #4493 -- Noted that the LocaleMiddleware's placement w.r.t

CacheMiddleware is important. Thanks, SmileyChris.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6575 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2007-10-21 12:12:45 +00:00
parent df644cbab9
commit 4c3586582d
1 changed files with 7 additions and 4 deletions

View File

@ -228,7 +228,7 @@ entire site. Just add ``'django.middleware.cache.CacheMiddleware'`` to your
'django.middleware.common.CommonMiddleware',
)
(The order of ``MIDDLEWARE_CLASSES`` matters. See "Order of MIDDLEWARE_CLASSES"
(The order of ``MIDDLEWARE_CLASSES`` matters. See `Order of MIDDLEWARE_CLASSES`_
below.)
Then, add the following required settings to your Django settings file:
@ -565,8 +565,11 @@ within the ``MIDDLEWARE_CLASSES`` setting, because the cache middleware needs
to know which headers by which to vary the cache storage. Middleware always
adds something to the ``Vary`` response header when it can.
Put the ``CacheMiddleware`` after any middlewares that might add something to
the ``Vary`` header. The following middlewares do so:
Put the ``CacheMiddleware`` *before* any other middleware that might add
something to the ``Vary`` header (response middleware is applied in reverse
order). The following middleware modules do so:
* ``SessionMiddleware`` adds ``Cookie``
* ``GZipMiddleware`` adds ``Accept-Encoding``
* ``LocaleMiddleware`` adds ``Accept-Language``