Skip to content
This repository

Enable Gzip compression by default #7327

Closed
wants to merge 7 commits into from

6 participants

Jeroen van Ingen José Valim Steve Klabnik Guillermo Iguaran Piotr Sarnacki Emil Kampp
Jeroen van Ingen

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 ;)

Jeroen van Ingen

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

José Valim
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.

Jeroen van Ingen

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

Steve Klabnik
Collaborator

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

Steve Klabnik
Collaborator

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

Guillermo Iguaran
Owner

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

Jeroen van Ingen

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

Piotr Sarnacki
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.

Emil Kampp

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)

Jeroen van Ingen

@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
This page is out of date. Refresh to see the latest.
4 guides/code/getting_started/config.ru
... ... @@ -1,4 +1,8 @@
1 1 # This file is used by Rack-based servers to start the application.
2 2
3 3 require ::File.expand_path('../config/environment', __FILE__)
  4 +
  5 +# enable Gzip compression on your webserver
  6 +# use Rack::Deflater
  7 +
4 8 run Blog::Application
4 railties/lib/rails/generators/rails/app/templates/config.ru
... ... @@ -1,4 +1,8 @@
1 1 # This file is used by Rack-based servers to start the application.
2 2
3 3 require ::File.expand_path('../config/environment', __FILE__)
  4 +
  5 +# enable Gzip compression on your webserver
  6 +# use Rack::Deflater
  7 +
4 8 run <%= app_const %>

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.