Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it necessary to set language cookie on every response in TranslationMiddleware? #171

Open
Quadric opened this issue Nov 14, 2019 · 1 comment

Comments

@Quadric
Copy link

Quadric commented Nov 14, 2019

Issue summary

In TranslationMiddleware on process_response "set_cookie" is executed on every response - even when proper cookie for specific language is already set. This leads to problem with proxies and caching. If response sets a cookie most standard proxy configuration will prevent this response from being cached (304 Not modfied etc)

How to reproduce?

  1. Open a TranslateableSite with enabled TranslationMiddleware
  2. You'll see "set-cookie: django_language=pl; Path=/"
  3. You'll see above everytime in response

Technical details

Python version: 3.6.4
Django version: 2.2.6
Wagtail version: 2.6.3
Wagtaltrans version: 2.0.6

@mikedingjan
Copy link
Member

If a proper check can be implemented for the cookie if the value doesn't change, I don't see any problems with changing this to only set it when the value changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants