How to compress HTTP responses using mongrel

I have a rails application that uses js (more than 1 MB). I would like to compress them to reduce the overall load time of the site.

I did a quick search and found that most browsers accept compressed content.

I would like to know what I can do to make the rails application send compressed content and thus improve the user experience.

+3
source share
2 answers

You should always proxy the web server for your mogrels, processing a portion of static content and its compression. Requests for static content should never be passed to husbands.

eg. with nginx, it's just a matter of adding gzip directives to your configuration file.

http://topfunky.net/svn/shovel/nginx/conf/nginx.conf

# output compression saves bandwidth 
  gzip            on;
  gzip_http_version 1.0;
  gzip_comp_level 2;
  gzip_proxied any;
  gzip_types      text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
+4

All Articles