Last Updated: February 25, 2016
·
2.462K
· XaMuT

How to prevent browsers from caching a page in Rails

...somewhere in a farfaraway_controller.rb...

before_filter :set_cache_buster
def set_cache_buster
  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

1 Response
Add your response