Set response headers to disable cache - to avoid back button emptying cart (#1213)

This commit is contained in:
stveep
2018-05-07 11:16:40 +01:00
committed by Maikel Linke
parent e356d712c4
commit 6efc0ab802

View File

@@ -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