I want to serve up all my content gzipped. I’m using Ruby on Rails 3 and the server has Apache/Phusion. I can see two main ways to compress output:
- Use an
after_filterlike the output_compression plugin - Use .htaccess file
Which way is more efficient? Is there a better way?
It looks like the output_compression plugin is fairly old. From my little experience with Rails, it looks like it would still work with Rails 3, but I’m not sure.
Also, if I use an after_filter, static files won’t be compressed, right?
You very much want to use mod_deflate:
http://httpd.apache.org/docs/2.0/mod/mod_deflate.html
It takes care of compressing all files served from the apache instance.