Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rack::Deflater already has this functionality? #33

Closed
jjb opened this issue Mar 11, 2017 · 3 comments
Closed

Rack::Deflater already has this functionality? #33

jjb opened this issue Mar 11, 2017 · 3 comments

Comments

@jjb
Copy link

jjb commented Mar 11, 2017

As I was writing #32 I had dejavu and did some digging, and remembered that since, I believe, rack 1.6, Rack::Deflater already has the ability to not compress images. Here's the PR: rack/rack#457

So:

module YourApp
  class Application < Rails::Application
    config.middleware.use Rack::Deflater, include: Rack::Mime::MIME_TYPES.select{|k,v| v =~ /text|json|javascript/ }.values.uniq
  end
end

Just wanted to point that out in case it relieves the maintainers of heroku-deflater some burden :)

@jjb jjb changed the title Rack::Deflator already has this functionality? Rack::Deflater already has this functionality? Mar 11, 2017
@david-a-wheeler
Copy link

I do not think that Rack::Deflator can do this:

Before serving a file from disk to a gzip-enabled client, it will look for a precompressed file in the same location that ends in ".gz". The purpose is to avoid compressing the same file each time it is requested.

@jjb
Copy link
Author

jjb commented Apr 16, 2017

Oh whoops, true. But rails does that (see #32).

So maybe heroku-deflater can be changed to leverage rack-deflater's capabilities but still serve precompiled gziped files, and be useful for non-rails rack projects.

@jjb
Copy link
Author

jjb commented Apr 16, 2017

made #37, closing

@jjb jjb closed this as completed Apr 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants