Enable Defalter Compression for Sinatra on Heroku

You guys must have heard about PageSpeed test from Google. It’s a really cool plugin for Chrome to let you know how you can optimize your webpage faster. I have been using it for a while but I couldn’t get my head around gzip compression which it seems that Google has taken that seriously. If you want the science bit. Here’s the article from Google.

And here’s the quickstart bit. The most simplest way is to put the compression in config.ru

1
2
3
require './server'
use Rack::Deflater
run Sinatra::Application

And that’s it I hope this will save you sometime.

Jan 15th, 2013

Comments