diff options
-rw-r--r-- | app/controllers/application.rb | 8 | ||||
-rw-r--r-- | app/controllers/general_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/help_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/public_body_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/request_controller.rb | 4 |
5 files changed, 15 insertions, 9 deletions
diff --git a/app/controllers/application.rb b/app/controllers/application.rb index 9a1ef035b..e427fda9c 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application.rb @@ -6,7 +6,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: application.rb,v 1.52 2009-01-08 16:57:16 francis Exp $ +# $Id: application.rb,v 1.53 2009-07-14 23:30:37 francis Exp $ class ApplicationController < ActionController::Base @@ -225,6 +225,12 @@ class ApplicationController < ActionController::Base session[:last_body_id] = public_body.id end + # Set cache headers for Squid reverse proxy in front of application + def cache_in_squid(max_age = 10) + response.headers["Vary"] = 'Cookie, Accept-Encoding' + expires_in max_age.minutes, :private => false + end + # URL generating functions are needed by all controllers (for redirects), # views (for links) and mailers (for use in emails), so include them into # all of all. diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb index edc80c5b9..03a5c6884 100644 --- a/app/controllers/general_controller.rb +++ b/app/controllers/general_controller.rb @@ -5,7 +5,7 @@ # Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: general_controller.rb,v 1.49 2009-07-14 23:02:06 francis Exp $ +# $Id: general_controller.rb,v 1.50 2009-07-14 23:30:37 francis Exp $ class GeneralController < ApplicationController @@ -30,7 +30,7 @@ class GeneralController < ApplicationController @successful_requests = [] end - expires_in 10.minutes, :private => false # cache via squid reverse proxy + cache_in_squid end # Just does a redirect from ?query= search to /query diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb index b792738a4..01991917c 100644 --- a/app/controllers/help_controller.rb +++ b/app/controllers/help_controller.rb @@ -4,12 +4,12 @@ # Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: help_controller.rb,v 1.11 2009-07-14 23:02:06 francis Exp $ +# $Id: help_controller.rb,v 1.12 2009-07-14 23:30:37 francis Exp $ class HelpController < ApplicationController def about - expires_in 10.minutes, :private => false # cache via squid reverse proxy + cache_in_squid end def unhappy diff --git a/app/controllers/public_body_controller.rb b/app/controllers/public_body_controller.rb index df4562efe..ad29c0b35 100644 --- a/app/controllers/public_body_controller.rb +++ b/app/controllers/public_body_controller.rb @@ -4,7 +4,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: public_body_controller.rb,v 1.3 2009-07-14 23:02:06 francis Exp $ +# $Id: public_body_controller.rb,v 1.4 2009-07-14 23:30:37 francis Exp $ class PublicBodyController < ApplicationController # XXX tidy this up with better error messages, and a more standard infrastructure for the redirect to canonical URL @@ -91,7 +91,7 @@ class PublicBodyController < ApplicationController end end - expires_in 10.minutes, :private => false # cache via squid reverse proxy + cache_in_squid end end diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 3b9aa422b..c91f2fad8 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -4,7 +4,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: request_controller.rb,v 1.167 2009-07-14 23:02:06 francis Exp $ +# $Id: request_controller.rb,v 1.168 2009-07-14 23:30:37 francis Exp $ class RequestController < ApplicationController @@ -111,7 +111,7 @@ class RequestController < ApplicationController @feed_autodetect = [ { :url => do_track_url(@track_thing, 'feed'), :title => @track_thing.params[:title_in_rss] } ] - expires_in 10.minutes, :private => false # cache via squid reverse proxy + cache_in_squid end # Page new form posts to |