diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e19c9bb26b..a4bdc88b8f 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -4,6 +4,7 @@ class ApplicationController < ActionController::Base protect_from_forgery prepend_before_filter :restrict_iframes + before_filter :set_cache_headers # Issue #1213, prevent cart emptying via cache when using back button include EnterprisesHelper helper CssSplitter::ApplicationHelper @@ -152,4 +153,10 @@ class ApplicationController < ActionController::Base nil end + def set_cache_headers # https://jacopretorius.net/2014/01/force-page-to-reload-on-browser-back-in-rails.html + response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate" + response.headers["Pragma"] = "no-cache" + response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT" + end + end