Last active
December 21, 2015 14:09
-
-
Save mwlang/6318000 to your computer and use it in GitHub Desktop.
A Rack module that will cause the browser to always fetch the entire contents of page. Useful for environments where you're behind a caching server.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Rack | |
| class NoCache | |
| def initialize(app) | |
| @app = app | |
| end | |
| def call(env) | |
| status, headers, body = @app.call(env) | |
| headers['Pragma'] = 'no-cache' | |
| headers['Cache-Control'] = 'no-store' | |
| # expire a year ago! | |
| headers['Expires'] = (Time.now - 1.year).rfc2822 | |
| [status, headers, body] | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment