Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Enable Gzip compression by default #7327

Closed
wants to merge 7 commits into from

6 participants

@jeroeningen

Because I was wondering why Rails doesn't enable Gzip compression by default, I added it in the template, the same way I'll do it in my apps.

There may be a good reason of not enabling Gzip compression by default. If so I'd like to hear it of course ;)

@jeroeningen

I don't understand why Github display all my commits, but this pull request applies to commit 'd49f4a7'

@josevalim
Owner

Because it is usually easier and faster to do it in your webserver! If we are adding this line, I would leave it commented. But let's see what others will talk about it.

@jeroeningen

What do you exactly mean with 'easily and faster'?

I find it more easy to add it in my config.ru then editing my webserver (in my case Apache) config, since I'm not an expert in Apache.
And do you mean with 'faster' that the webserver performes better when you set the configuration in your webserver instead of in your Rails app. If so, I can imagine that you don't want to turn it on by default using your config.ru

@steveklabnik
Collaborator

Yeah, this is really a webserver thing. I'm not :-1:, but I'm not :+1: either.

@steveklabnik
Collaborator

Actually, isn't Rack::Deflater another middleware? I think I am :-1: on this, we have so many middleware already.

@guilleiguaran

Recently I found this useful in an app hosted in Heroku Cedar stack, is a :+1: in my side but please leave it commented

@jeroeningen

In addition to the idea of @guilleiguaran I commented it out by default

@drogus
Collaborator

Frankly, I'm not a big fan of such comments - generators could be full of things that people may need. If you turn compression on you should have an idea what you're doing and if you know what you're doing you will not have too much problems with finding the solution if you don't have access to web server.

That said, if others think that it might be useful, it certainly should go as a comment, not something that is turned on by default.

@ekampp

I think that the second, you really need something like this, your application is large enough that you need to put it behind some server-front (e.g. nginx or varnish) that can do the deflation for you.

IMHO rails should focus on being good at the MVC stack (just like integrated support for prototype was dropped)

@jeroeningen

@ekampp I think you're right. Rails should focus on being an MVC.

Enabling Gzip was an idea, but I think we now have enough arguments to not implement it ;)

IMO feature closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 26, 2012
  1. ActiveRecord#pluck now accepts multiple columns

    jeroeningen authored
Commits on May 31, 2012
  1. @jeroeningen
  2. @jeroeningen
Commits on Aug 10, 2012
  1. @jeroeningen

    Merge remote-tracking branch 'upstream/master'

    jeroeningen authored
    Conflicts:
    	activerecord/lib/active_record/relation/calculations.rb
    	activerecord/test/cases/calculations_test.rb
  2. @jeroeningen
Commits on Aug 11, 2012
  1. @jeroeningen
  2. @jeroeningen
This page is out of date. Refresh to see the latest.
View
4 guides/code/getting_started/config.ru
@@ -1,4 +1,8 @@
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
+
+# enable Gzip compression on your webserver
+# use Rack::Deflater
+
run Blog::Application
View
4 railties/lib/rails/generators/rails/app/templates/config.ru
@@ -1,4 +1,8 @@
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
+
+# enable Gzip compression on your webserver
+# use Rack::Deflater
+
run <%= app_const %>
Something went wrong with that request. Please try again.