diff options
| author | mo khan <mo@mokhan.ca> | 2013-05-19 16:12:03 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2013-05-19 16:12:03 -0600 |
| commit | 41f8320a564681d408aea43becff15c91d23396f (patch) | |
| tree | 66d4fa7e5195044df2988c9c0b84a41e050b9bf1 | |
| parent | bcb8f3c62c6a7d3e9db01401a688b2f55c0d2131 (diff) | |
add cache headers for static assets
| -rw-r--r-- | lib/web/responses/asset_response.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/web/responses/asset_response.rb b/lib/web/responses/asset_response.rb index edbf406..9aa9beb 100644 --- a/lib/web/responses/asset_response.rb +++ b/lib/web/responses/asset_response.rb @@ -9,7 +9,12 @@ module Booty end def run(view_engine) - [@status, {"Content-Type" => @content_type}, [File.read(File.join(Dir.pwd, @file_path))]] + headers = { + "Content-Type" => @content_type, + "Cache-control" => "public, max-age=31536000", + "Expires" => "Wed, 01 Jan 2014 22:00:00 GMT" + } + [@status, headers, [File.read(File.join(Dir.pwd, @file_path))]] end end end |
