Skip to content

Instantly share code, notes, and snippets.

@mwlang
Last active December 21, 2015 14:09
Show Gist options
  • Select an option

  • Save mwlang/6318000 to your computer and use it in GitHub Desktop.

Select an option

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.
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