Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
LocaleMiddleware breaks caching
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Harm Verhagen  
View profile  
 More options Mar 28 2010, 8:41 am
From: Harm Verhagen <harm.verha...@gmail.com>
Date: Sun, 28 Mar 2010 05:41:40 -0700 (PDT)
Local: Sun, Mar 28 2010 8:41 am
Subject: LocaleMiddleware breaks caching
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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »