I'm running a Rails 3.1.1 application on Heroku Cedar. By default this stack doesn't Gzip and set Expires Headers on assets. There is some doc about that, but it's not very clear : http://devcenter.heroku.com/articles/http-routing
Can somebody give me the piece of code to activate that ?
Thank you very much
Cedar doesn't use Nginx, so you have to gzip assets yourself with Rack::Deflater, like so :
# config.ru require ::File.expand_path('../config/environment', __FILE__) use Rack::Deflater run YourApp::Application
Also you can set headers for static files directly in your app :
# config/environments/production.rb config.static_cache_control = "public, max-age=3600"
Finally you're probably better off setting up Rack::Cache to replace Varnish caching. See this blog post for more infos.
Shameless plug - I created a gem which enables compression, but avoids compressing images.
https://github.com/romanbsd/heroku-deflater
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With