Merge pull request #2268 from stveep/1213-back-empties-cart

Set response headers to disable cache - to avoid back button emptying…
This commit is contained in:
Maikel
2018-05-18 10:54:05 +10:00
committed by GitHub

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