Opened 17 years ago

Closed 17 years ago

#4943 closed (fixed)

Cache middleware description

Reported by: anonymous Owned by: nobody
Component: Documentation Version: dev
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Original text:
Order of MIDDLEWARE_CLASSES

If you use CacheMiddleware, it’s important to put it in the right place 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:
SessionMiddleware adds Cookie
GZipMiddleware adds Accept-Encoding



First, the list lacks LocaleMiddleware as it adds vary Accept-Language.
Second, the responce is handled by middleware in reverse order, hence CacheMiddle must be placed BEFORE any middleware that change vary header.

Attachments (1)

4943.patch (1.1 KB ) - added by Chris Beaven 17 years ago.

Download all attachments as: .zip

Change History (3)

by Chris Beaven, 17 years ago

Attachment: 4943.patch added

comment:1 by Chris Beaven, 17 years ago

Triage Stage: UnreviewedReady for checkin

comment:2 by Malcolm Tredinnick, 17 years ago

Resolution: fixed
Status: newclosed

Fixed in [6575], although I typed the wrong ticket number in the commit message.

Note: See TracTickets for help on using tickets.
Back to Top