* 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.
* has_patch: 0 => 1
Comment:
I've created a pull request, https://github.com/django/django/pull/14416
--
Ticket URL: <https://code.djangoproject.com/ticket/32768#comment:1>
* stage: Unreviewed => Accepted
Comment:
OK, I think this looks right. Let's take it for review to get other eyes
on it. Thanks.
--
Ticket URL: <https://code.djangoproject.com/ticket/32768#comment:2>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/32768#comment:3>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"eeed488a3439c5c5c3f0b5991ee400851057e127" eeed488a]:
{{{
#!CommitTicketReference repository=""
revision="eeed488a3439c5c5c3f0b5991ee400851057e127"
Fixed #32768 -- Added Vary header when redirecting to prefixed i18n
pattern.
get_language_from_request() uses Accept-Language and/or Cookie to
determine the
correct redirect. Upstream caches need the matching Vary header to cache
the
result.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/32768#comment:4>