maletor
maletor

Reputation: 7122

Any way to serve gzip assets from heroku?

I'm wondering if there is any way to get the Rails webserver (thin) to serve the *.gz files the asset pipeline creates. As I understand, those have a higher compression level than that of Rack::Deflater, which only works with serve_static_assets from within the rackup file and not in config.middleware.

A less optimal solution might be to change the default compression level of Zlib which is what Rack::Deflater references. It should only need to gzip once, then it goes to Rack::Cache, then hopefully a CDN.

A second less optimal solution might be a Rack::Rewrite.

Upvotes: 22

Views: 12652

Answers (2)

cabe56
cabe56

Reputation: 404

Use this gem github.com/mattolson/heroku_rails_deflate

Upvotes: 0

Mike
Mike

Reputation: 9842

The answer to your question can be found at https://gist.github.com/2152663.

Upvotes: 11

Related Questions