Skip to content

Commit

Permalink
Use a more browser cachable header for rendered images in production …
Browse files Browse the repository at this point in the history
…mode. [AlexJWayne#1 stae:resolved]
  • Loading branch information
AlexJWayne authored and dummied committed Jan 21, 2009
1 parent 2d48c4e commit e84ea30
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/fleximage/view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ def color(*args)
# Set proper content type
@view.controller.response.content_type = Mime::Type.lookup_by_extension(requested_format.to_s).to_s

# Set proper caching headers
if defined?(Rails) && Rails.env == 'production'
@view.controller.response.headers['Cache-Control'] = 'public, max-age=86400'
end

# return rendered result
return result.output_image(:format => requested_format)
ensure
Expand Down

0 comments on commit e84ea30

Please sign in to comment.