From e48e4ccbd3bb1a61c82bf3a83e1c66217cb0ccac Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Wed, 5 Aug 2009 20:35:28 +0000 Subject: [PATCH] Send an appropriate Vary header when we negotiate the language to stop caches doing the wrong thing. Closes #1995. --- app/controllers/application_controller.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 0d6cdea64..2093a959c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -101,9 +101,12 @@ class ApplicationController < ActionController::Base end def set_locale + response.header['Vary'] = 'Accept-Language' + if @user if !@user.languages.empty? request.user_preferred_languages = @user.languages + response.header['Vary'] = '*' elsif !request.user_preferred_languages.empty? @user.languages = request.user_preferred_languages @user.save -- 2.39.5