Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enabling browser side caching for rails 3.1 app on heroku

I have a quite a big jpg image file and few css files, and these are not going to change for every reload but every time it is loading the full imgae instead of caching in the browser, I tried changing the config like config.action_controller.perform_caching = true etc but nothing seems to help. Is there a way to do that?

like image 477
n00b Avatar asked Nov 09 '11 11:11

n00b


1 Answers

This worked for me in my production.rb:

config.serve_static_assets = true
config.static_cache_control = "public, max-age=2419200"

That is 4 weeks which I figure is good enough.

like image 136
Wilhelm Avatar answered Oct 07 '22 00:10

Wilhelm