Skip to content

Instantly share code, notes, and snippets.

@D-system
Created March 19, 2015 08:16
Show Gist options
  • Save D-system/de02cee13dd92932a1bd to your computer and use it in GitHub Desktop.
Save D-system/de02cee13dd92932a1bd to your computer and use it in GitHub Desktop.
Expires any page in any situation (including the back button action)
def expires_now
# override default method due to some browsers cases (http://stackoverflow.com/a/18516720/856151)
response.headers['Cache-Control'] = 'no-cache, no-store, must-revalidate' # HTTP 1.1.
response.headers['Pragma'] = 'no-cache' # HTTP 1.0.
response.headers['Expires'] = '0' # Proxies.
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment