#32768: An incorrect language is sometimes displayed - redirects adding a 
language
code to a path can be inappropriate cached by HTTP caches
------------------------------------------------+------------------------
               Reporter:  ahaywardtvuk          |          Owner:  nobody
                   Type:  Bug                   |         Status:  new
              Component:  Internationalization  |        Version:  3.1
               Severity:  Normal                |       Keywords:
           Triage Stage:  Unreviewed            |      Has patch:  0
    Needs documentation:  0                     |    Needs tests:  0
Patch needs improvement:  0                     |  Easy pickings:  0
                  UI/UX:  0                     |
------------------------------------------------+------------------------
 We have a multi-lingual site using LocaleMiddleware. With a CDN and
 caching reverse proxy in use, the following sequence of events can happen:

 * Fetch https://example.com/some-page/ with Accept-Language header 'de-
 DE,de;q=0.9'. A redirect to https://example.com/de/some-page/ is returned.
 * Fetch it again with Accept-Language header 'fr-FR,fr;q=0.9'. The cached
 redirect is returned by HTTP caches and the German page is displayed
 instead of the French one.

 LocaleMiddleware is issuing a redirect based on the detected language from
 the Accept-Language header or from the cookie chosen by
 settings.LANGUAGE_COOKIE_NAME but is not telling caches that it has used
 these headers.

 Adding a Vary header fixes this.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32768>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/055.35e80e8b8991a6852b70d573fd96bea0%40djangoproject.com.

Reply via email to