Compress Responses Using Rack::Deflater On Rails

Posted By Weston Ganger

You can easily compress your responses from your Rails app with a one-liner. No additional gems required.

This comes at a very small cost to response time but can reduce your responses size by about 10x.

Heres how to set it up in Rails:


# config/application.rb

# This must come before some other middlewares such as JSONP
config.middleware.use Rack::Deflater


You can also add this to any Rack Application


use Rack::Deflater
run MyApp::Instance


Related External Links:

Article Topic:Software Development - Rails

Date:April 14, 2016