Compress Responses Using Rack::Deflater On Rails

Posted by Weston Ganger on April 14, 2016

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:

Posted in Rails and Tagged with rails rack 

Need help on your next project or application?

I specialize in Ruby-on-Rails, AngularJS, Javascript, Bootstrap, and Hybrid Mobile Apps with Cordova & Ionic.

Contact Me

Recommended Posts