GZIP output compression
Add HTTP compression to all Ruby on Rails requests.
“Output Compression” by Tom Fakes is a Ruby on Rails plugin that adds GZIP output compression for clients that support it.
GZIP compression is a common way to compress the content of web pages on the server before the request is sent on to the browser. The browser decompresses the content and renders it. This method passes less data over the network, up to 55% less in my case, but has a small performance hit as both the server and the browser need to (de)compress the package.
The Ruby on Rails plugin is great but is broken at the time of writing (in Ruby 1.8.2) and needs some manual fixing… lets fix it.
First, install the plugin (sudo not needed).
Open the output_compression.rb file in the vendor/plugins/output_compression/lib/ folder and move the “alias :original_request_for_component :request_for_component” line below the request_for_component one. Change this:
Next, add the following line to the controller you would like to enable GZIP for. I chose to add it to my application controller to enable compression for all my pages.
Check for GZIP compressed requests via the HTTP Compression Test.