Skip to content

Instantly share code, notes, and snippets.

@chanks
Created May 29, 2011 20:46
Show Gist options
  • Save chanks/998124 to your computer and use it in GitHub Desktop.
Save chanks/998124 to your computer and use it in GitHub Desktop.
Override static asset cache expiration on Heroku.
# Stick the following in an initializer.
module Heroku
class StaticAssetsMiddleware
def cache_static_asset(reply)
return reply unless can_cache?(reply)
status, headers, response = reply
headers['Cache-Control'] = 'public, max-age=31556926' # 1 year
build_new_reply(status, headers, response)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment