Skip to content

Instantly share code, notes, and snippets.

@abhianair
Created January 27, 2020 06:01
Show Gist options
  • Save abhianair/4f4631f67da46f1105ad99f1d7fa69a7 to your computer and use it in GitHub Desktop.
Save abhianair/4f4631f67da46f1105ad99f1d7fa69a7 to your computer and use it in GitHub Desktop.
Avoiding caching the login page
class ApplicationController < ActionController::Base
before_filter :set_cache_headers
private
def set_cache_headers
response.headers["Cache-Control"] = "no-cache, no-store"
response.headers["Pragma"] = "no-cache"
response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment