Created
May 29, 2011 20:46
-
-
Save chanks/998124 to your computer and use it in GitHub Desktop.
Override static asset cache expiration on Heroku.
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
# 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