Why is my js+css not compressed in production on Rails + Heroku?
gzip, heroku, ruby-on-rails
Solution
You need to edit the `config.ru` file, located in your project root:
require ::File.expand_path('../config/environment', __FILE__)
# Add beautifully gzipped responses
use Rack::Deflater
run YourApp::Application
Problem
I am running my producction environment with following settings, and it appears that it is minifying but is not gzipping/compressing the response. ``` # Disable Rails's static asset server (Apache or nginx will already do this) config.serve_static_assets = false # Compress JavaScripts and CSS config.assets.compress = true # Don't fallback to assets pipeline if a precompiled asset is missed config.assets.compile = false # Generate digests for assets URLs config.assets.digest = true ``` Here is my js file, and the headers dont contain gzip or deflate??? ``` $ curl -I http://sctest-perf.herokuapp.com/assets/application-1d21d488644b11e5610fa26bacdbc868.js HTTP/1.1 200 OK Age: 0 Cache-Control: public, max-age=31536000 Content-length: 213394 Content-Type: application/javascript Date: Fri, 08 Jun 2012 20:34:58 GMT Etag: "1d21d488644b11e5610fa26bacdbc868" Last-Modified: Wed, 30 May 2012 16:38:32 GMT Status: 200 OK X-Content-Digest: 914bc6f80b0619be63c1302821ccc24a082ace53 X-Rack-Cache: miss, store X-Request-Id: 76cb22ef23b73c440878569eec42ed4d X-Runtime: 0.001314 X-Ua-Compatible: IE=Edge,chrome=1 Connection: keep-alive ```