Send an appropriate Vary header when we negotiate the language to stop
authorTom Hughes <tom@compton.nu>
Wed, 5 Aug 2009 20:35:28 +0000 (20:35 +0000)
committerTom Hughes <tom@compton.nu>
Wed, 5 Aug 2009 20:35:28 +0000 (20:35 +0000)
caches doing the wrong thing. Closes #1995.

app/controllers/application_controller.rb

index 0d6cdea6424fea77b93e32e047796546008a1637..2093a959c85af202b2d4a4dfce420578f65489c9 100644 (file)
@@ -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