One good practice for your assets is to gzip them and serve them compressed. To do this in your Rails app, you can make use of the Rack::Deflater middleware. Make sure that you use it in your middleware stack, before the middleware that does the handling of static assets.
For example, if you’re using ActionDispatch::Static , you’d want Rack::Deflater before it. Here’s how you do such a thing:
- open your config/environments/production.rb
- Add this:
config.middleware.insert_before ActionDispatch::Static, Rack::Deflater
See the magic.You can know it from firebug NET All request.