Hi, I found out using i18n with django breaks caching completely. (reverse proxy & browser caching, that is).
Initially I filed a bug about this [1], But its more complicated that just a bug. Therefor I post the topic here. Whats the problem: enabling django.middleware.locale.LocaleMiddleware, makes your complete site un-cachable, as _every_ response gets automatically the following http header "Vary: Cookie" (as LocaleMiddleware reads the session -> session.accessed becomes True -> Vary: Cookie gets added). "Vary: Cookie" effectively means, with all current browsers, that the browser will not, never cache the page. As discussed in [1], there is nothing you can do on views that actually user i18n. They really do vary on the cookie. Unfortunately, this happens for _every_ view, also the views that do _not_ have anything to do with translations. So I'm wondering if we can improve django locale handling, so that only views that matter from an i18n point-of-view, get the "Vary: Cookie" header. some thoughts: a) Make LocaleMiddleware configurable, which urls are i18n enabled and which not. (but include/exclude patterns. b) can we somehow make the reading of the session by LocaleMiddleware so lazy, that only when translation kicks in we touch the session. Any thoughts? Regards, Harm [1] http://code.djangoproject.com/ticket/13217 -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
