Code Monkey home page Code Monkey logo

heroku-deflater's Introduction

heroku-deflater

A simple rack middleware that enables compressing of your sprockets and webpacker assets and application responses on Heroku, while not wasting CPU cycles on pointlessly compressing images and other binary responses.

It also includes code from https://github.com/mattolson/heroku_rails_deflate

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.

Installing

Add to your Gemfile:

gem 'heroku-deflater', :group => :production

Contributing to heroku-deflater

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
  • Fork the project.
  • Start a feature/bugfix branch.
  • Commit and push until you are happy with your contribution.
  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright

Copyright (c) 2012 Roman Shterenzon. See LICENSE.txt for further details.

heroku-deflater's People

Contributors

dependabot[bot] avatar dylanfisher avatar ekampp avatar jjaffeux avatar maletor avatar migl avatar olliebennett avatar romanbsd avatar route avatar rykov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

heroku-deflater's Issues

Issue with rails 5 API only setup

I want to use heroku-deflater to gzip output of my API only app but It fails with following error

NoMethodError: undefined method `assets' for #<Rails::Application::Configuration:0x000000042682a8>
Did you mean?  asset_host
/app/vendor/bundle/ruby/2.4.0/gems/railties-5.0.1/lib/rails/railtie/configuration.rb:95:in `method_missing'

workaround is to require 'sprockets/railtie' but there should be option to skip that

Likely issue with rails 6.1.0-alpha

Using rails 00c2d3e1e61093451a00b1b70548cfd9ae549c53 as of this writing.

2020-06-13T18:37:54+00:00: Rack app error handling request { GET /assets/admin-c9569c117d1107474494012b3a255f49a3570eedd08e51123008d0412abc93cb.js }
#<NoMethodError: undefined method `match?' for #<ActionDispatch::FileHandler:0x000055dc97100c10>>
/app/vendor/bundle/ruby/2.6.0/gems/heroku-deflater-0.6.3/lib/heroku-deflater/serve_zipped_assets.rb:31:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-2.2.2/lib/rack/sendfile.rb:110:in `call'
/app/vendor/bundle/ruby/2.6.0/bundler/gems/rails-c13d46937445/actionpack/lib/action_dispatch/middleware/host_authorization.rb:76:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/sentry-raven-2.13.0/lib/raven/integrations/rack.rb:51:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-cors-1.1.1/lib/rack/cors.rb:100:in `call'

I'd guess this is related to this commit, which not only removes the match? method - it does away with FileHandler in favor of Static

undefined method `cache_control_manager' for HerokuDeflater::Railtie:Class

Using Ruby 2.4.0 and Rails 5.0.1, I get this error on both heroku and my local environment:

/home/ben/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.0.1/lib/rails/railtie.rb:195:in `method_missing': undefined method `cache_control_manager' for HerokuDeflater::Railtie:Class (NoMethodError)
        from /home/ben/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/heroku-deflater-0.6.3/lib/heroku-deflater/railtie.rb:18:in `block in <class:Railtie>'

It goes away if I change https://github.com/romanbsd/heroku-deflater/blob/master/lib/heroku-deflater/railtie.rb to

require 'rack/deflater'
require 'heroku-deflater/skip_binary'
require 'heroku-deflater/serve_zipped_assets'
require 'heroku-deflater/cache_control_manager'

module HerokuDeflater
  class Railtie < Rails::Railtie
    initializer 'heroku_deflater.configure_rails_initialization' do |app|
      app.middleware.insert_before ActionDispatch::Static, Rack::Deflater
      app.middleware.insert_before ActionDispatch::Static, HerokuDeflater::SkipBinary
      app.middleware.insert_before Rack::Deflater, HerokuDeflater::ServeZippedAssets,
        app.paths['public'].first, app.config.assets.prefix, self.class.cache_control_manager(app)
    end

    def self.cache_control_manager(app)
      @_cache_control_manager ||= CacheControlManager.new(app)
    end

    # Set default Cache-Control headers to one week.
    # The configuration block in config/application.rb overrides this.
    config.before_configuration do |app|
      cache_control = cache_control_manager(app)
      cache_control.setup_max_age(86400)
    end
  end
end

That is, I'm moving the def self.cache_control_manager above the config.before_configuration block. Which is a trivial fix, but makes me wonder what else is going on.

Cache-Control header not set in Rails 5

I'm having trouble overwriting the Cache-Control header in my Rails 5 app. I have the following in my /config/environments/production.rb file:

  config.public_file_server.headers = {
      'Cache-Control' => 'public, max-age=31536000',
      'Expires' => "#{1.year.from_now.to_formatted_s (:rfc822)}"
  }

This is applying to binary images fine (JPG/PNG/GIF) but JS and CSS assets still have the default max age of 86400 being applied (public, max-age=86400)

How am I able to update that? Is the configuration setting above not supposed to apply to those files as well?

I've tried specifying the gem using the GIT url directly as I noticed a fix for this recently. This did not change anything.

When I enable them gem in development I see max-age=31536000 set, however I don't seem to be able to update that either if I try a different value in development.rb and clear caches and restart servers.

Rails 4: ActionDispatch::Static isn't in production middleware

Insert before ActionDispatch::Static throws in a default Rails 4 app as it no longer serves static assets by default.

As a workaround one can change: config.serve_static_assets = false to true but I think the heroku-deflater gem should work without server_static_assets being set to true.

Could not find heroku-deflater-0.6.1 in any of the sources

After running

bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment

I got the following error

Fetching gem metadata from https://rubygems.org/........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Could not find heroku-deflater-0.6.1 in any of the sources

My Gemfile

source 'https://rubygems.org'
ruby '2.2.3'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.1'
# Use pg as the database for Active Record
gem 'pg'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
# gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

# third party apis
gem 'devise'
gem 'omniauth'
gem 'omniauth-facebook'
gem "koala", "~> 2.0"
gem "google-api-client"
gem 'freebase-api'

gem 'resque', "~> 1.22.0"
gem "factory_girl_rails", "~> 4.0"
gem "sprockets", "2.11.0"

# Web server for heroku
gem 'puma'
# Starts heroku apps
gem 'foreman'

# Enables minification of assets
gem 'heroku-deflater', :group => :production
# Enables logging in heroku and some kind of asset serving
gem 'rails_12factor', group: :production

gem 'newrelic_rpm'

group :development, :test do
    # Call 'byebug' anywhere in the code to stop execution and get a debugger console
    gem 'byebug'

    gem 'meta_request'

    # Access an IRB console on exception pages or by using <%= console %> in views
    gem 'web-console', '~> 2.0'

    # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
    gem 'spring'

    gem 'spring-commands-rspec'
    gem 'rspec-rails'
    gem 'guard-rspec'
    gem 'guard-livereload', '~> 2.4', require: false
end

group :test do
    gem 'minitest-reporters', '1.0.5'
    gem 'mini_backtrace',     '0.1.3'
    gem 'guard-minitest',     '2.3.1'
end

group :test, :darwin do
    gem 'rb-fsevent'
end

leverage Rack::Deflater's capabilities

Since, I believe, rack 1.6, Rack::Deflater 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

Maybe this capability can be leveraged in heroku-deflater to simplify the code? (if requiring that rack version is acceptable)

Support Rack 1.5.2

I want to use this useful middleware with Rack 1.5.2, which is needed by Rails 4.0.0.bata1.

Problems with Dragonfly TempObject

I was getting the error:

can't read from tempfile as TempObject has been closed

in my heroku logs, and no images were being served in my rails application. More details can be found at the trail here markevans/dragonfly#250 (comment).

It seems like I had problems with heroku-deflater middleware closing elements in a request body if they are images since it makes little sense to try and compress them further. However, the Dragonfly gem (I guess) requires these images to not be closed so that it can do further image processing (resizing etc) on them.

As I can't easily do without dragonfly (it is very much part of RefineryCMS which I am using) my workaround right now is just to not to use Heroku-deflater.

Gems I am using are refinerycms 2.1.1, dragonfly 0.9.15, rails 3.2.15 under Ruby 2.0, and I was using heroku-deflater 0.5.3 before I removed it.

It would be great to have this deflation back again but as I don't fully understand how middleware actually works (let alone dragonfly), I doubt I could submit a working patch.

Error when deploying with no sprockets

When I add this gem and deploy to Heroku I get the error:

  rake aborted!
       NoMethodError: undefined method `assets' for #<Rails::Application::Configuration:0x000056068bb95090>

I assume this is because Asset Pipeline/sprockets is disabled in my app?

I only use webpacker. Any chance this gem can handle no Sprockets?

`static_cache_control` is deprecated

From what I could glean, heroku-deflater checks the static-cache_control config. However, it looks like in Rails 5.1, setting public_file_server.headers is preferred.

config.static_cache_control deprecation warning

Rails: 5.0.0.1

DEPRECATION WARNING: `config.static_cache_control` is deprecated and will be removed in Rails 5.1.
Please use
`config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=604800' }`
instead.

incompatible with rack-mini-profiler

When I run heroku-delfater with rack-mini-profiler, I get an internal server error. There seems to be an incompatibility issue. Since they are both for optimization, it would be nice to get them to work together.

app error: closed stream (IOError)

TL;DR After updating to 0.5.3, nearly all of my asset requests were with a closed stream (IOError)

Stack trace:

18:02:51 web.1    | E, [2014-04-11T18:02:51.575456 #8280] ERROR -- : app error: closed stream (IOError)
18:02:51 web.1    | E, [2014-04-11T18:02:51.575567 #8280] ERROR -- : /opt/boxen/rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/deflater.rb:82:in `close'
18:02:51 web.1    | E, [2014-04-11T18:02:51.575685 #8280] ERROR -- : /opt/boxen/rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/deflater.rb:82:in `ensure in each'
18:02:51 web.1    | E, [2014-04-11T18:02:51.575757 #8280] ERROR -- : /opt/boxen/rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/deflater.rb:84:in `each'
18:02:51 web.1    | E, [2014-04-11T18:02:51.575925 #8280] ERROR -- : /opt/boxen/rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/lint.rb:647:in `each'
18:02:51 web.1    | E, [2014-04-11T18:02:51.576087 #8280] ERROR -- : /opt/boxen/rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/body_proxy.rb:31:in `each'
18:02:51 web.1    | E, [2014-04-11T18:02:51.576165 #8280] ERROR -- : /opt/boxen/rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/chunked.rb:23:in `each'
18:02:51 web.1    | E, [2014-04-11T18:02:51.576247 #8280] ERROR -- : /opt/boxen/rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/unicorn-4.8.2/lib/unicorn/http_response.rb:60:in `http_response_write'
18:02:51 web.1    | E, [2014-04-11T18:02:51.576339 #8280] ERROR -- : /opt/boxen/rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/unicorn-4.8.2/lib/unicorn/http_server.rb:582:in `process_client'
18:02:51 web.1    | E, [2014-04-11T18:02:51.576459 #8280] ERROR -- : /opt/boxen/rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/unicorn-4.8.2/lib/unicorn/http_server.rb:666:in `worker_loop'
18:02:51 web.1    | E, [2014-04-11T18:02:51.576537 #8280] ERROR -- : /opt/boxen/rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/unicorn-4.8.2/lib/unicorn/http_server.rb:521:in `spawn_missing_workers'
18:02:51 web.1    | E, [2014-04-11T18:02:51.576628 #8280] ERROR -- : /opt/boxen/rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/unicorn-4.8.2/lib/unicorn/http_server.rb:140:in `start'
18:02:51 web.1    | E, [2014-04-11T18:02:51.576747 #8280] ERROR -- : /opt/boxen/rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/unicorn-4.8.2/bin/unicorn:126:in `<top (required)>'
18:02:51 web.1    | E, [2014-04-11T18:02:51.576822 #8280] ERROR -- : /opt/boxen/rbenv/versions/2.0.0-p451/bin/unicorn:23:in `load'
18:02:51 web.1    | E, [2014-04-11T18:02:51.576893 #8280] ERROR -- : /opt/boxen/rbenv/versions/2.0.0-p451/bin/unicorn:23:in `<main>'

I read up on this a bit and found a thread here (http://rubyforge.org/pipermail/mongrel-unicorn/2013-September/001874.html) that mentions:

IOError means something in the unicorn process closed the connection
already, which should not happen there.

Do you have anything in your Rack app which does background processing
of rack.input after the response is written?

That would be the most likely explanation...

I dug into unicorn and rack/lint a bit and both seem to call body.close on their own, which apparently is something that all rack middleware should do, but now I'm getting complaints that the steam is already closed.

I then disabled unicorn and just went through webrick. Same issue:

2014-04-11 18:38:48] ERROR IOError: closed stream
    /opt/boxen/rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/deflater.rb:82:in `close'
    /opt/boxen/rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/deflater.rb:82:in `ensure in each'
    /opt/boxen/rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/deflater.rb:84:in `each'
    /opt/boxen/rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/body_proxy.rb:31:in `each'
    /opt/boxen/rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:72:in `service'
    /opt/boxen/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
    /opt/boxen/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
    /opt/boxen/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'

I think that Rack::Deflater is the middleware that is complaining because it's the middleware that runs immediately after HerokuDeflater::ServeZippedAssets:

# rake middleware
use HerokuDeflater::ServeZippedAssets
use Rack::Deflater
use HerokuDeflater::SkipBinary

I'm happy to go back to 0.5.2 but I'm curious what the cause of this issue is, and how we might solve it in a way that doesn't cause requests to fail. Happy to help in whatever way I can.

No such middleware to insert before: ActionDispatch::Static

After I changed "config.serve_static_assets" to false, I started to get the error below when I try to push to Heroku.

Not sure if it is related to http://stackoverflow.com/questions/7824570/heroku-conflict-between-gzipping-assets-and-precompiling-assets

No such middleware to insert before: ActionDispatch::Static
/tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/actionpack-3.1.12/lib/action_dispatch/middleware/stack.rb:119:in assert_index' /tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/actionpack-3.1.12/lib/action_dispatch/middleware/stack.rb:83:ininsert'
/tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/railties-3.1.12/lib/rails/configuration.rb:38:in block in merge_into' /tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/railties-3.1.12/lib/rails/configuration.rb:37:ineach'
/tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/railties-3.1.12/lib/rails/configuration.rb:37:in merge_into' /tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/railties-3.1.12/lib/rails/engine.rb:446:inapp'
/tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/railties-3.1.12/lib/rails/application/finisher.rb:37:in block in <module:Finisher>' /tmp/build_35d88t67t7z0x/config/application.rb:112:ininstance_exec'
/tmp/build_35d88t67t7z0x/config/application.rb:112:in run' /tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/railties-3.1.12/lib/rails/initializable.rb:55:inblock in run_initializers'
/tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/railties-3.1.12/lib/rails/initializable.rb:54:in each' /tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/railties-3.1.12/lib/rails/initializable.rb:54:inrun_initializers'
/tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/railties-3.1.12/lib/rails/application.rb:96:in initialize!' /tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/railties-3.1.12/lib/rails/railtie/configurable.rb:30:inmethod_missing'
/tmp/build_35d88t67t7z0x/config/environment.rb:129:in <top (required)>' /tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.12/lib/active_support/dependencies.rb:240:inrequire'
/tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.12/lib/active_support/dependencies.rb:240:in block in require' /tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.12/lib/active_support/dependencies.rb:223:inblock in load_dependency'
/tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.12/lib/active_support/dependencies.rb:640:in new_constants_in' /tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.12/lib/active_support/dependencies.rb:223:inload_dependency'
/tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.12/lib/active_support/dependencies.rb:240:in require' /tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/railties-3.1.12/lib/rails/application.rb:83:inrequire_environment!'
/tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/railties-3.1.12/lib/rails/application.rb:203:in block (2 levels) in initialize_tasks' /tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:246:incall'
/tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:246:in block in execute' /tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:241:ineach'
/tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:241:in execute' /tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:184:inblock in invoke_with_call_chain'
/tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:177:in invoke_with_call_chain' /tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:170:ininvoke'
/tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/actionpack-3.1.12/lib/sprockets/assets.rake:89:in block (2 levels) in <top (required)>' /tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:246:incall'
/tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:246:in block in execute' /tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:241:ineach'
/tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:241:in execute' /tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:184:inblock in invoke_with_call_chain'
/tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:177:in invoke_with_call_chain' /tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:205:inblock in invoke_prerequisites'
/tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:203:in each' /tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:203:ininvoke_prerequisites'
/tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:183:in block in invoke_with_call_chain' /tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:177:ininvoke_with_call_chain'
/tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:170:in invoke' /tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/actionpack-3.1.12/lib/sprockets/assets.rake:56:inblock (3 levels) in <top (required)>'
/tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:246:in call' /tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:246:inblock in execute'
/tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:241:in each' /tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:241:inexecute'
/tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:184:in block in invoke_with_call_chain' /tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:177:ininvoke_with_call_chain'
/tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:170:in invoke' /tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/actionpack-3.1.12/lib/sprockets/assets.rake:19:ininvoke_or_reboot_rake_task'
/tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/actionpack-3.1.12/lib/sprockets/assets.rake:25:in block (2 levels) in <top (required)>' /tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:246:incall'
/tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:246:in block in execute' /tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:241:ineach'
/tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:241:in execute' /tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:184:inblock in invoke_with_call_chain'
/tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:177:in invoke_with_call_chain' /tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:170:ininvoke'
/tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:143:in invoke_task' /tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:101:inblock (2 levels) in top_level'
/tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:101:in each' /tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:101:inblock in top_level'
/tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:110:in run_with_threads' /tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:95:intop_level'
/tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:73:in block in run' /tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:160:instandard_exception_handling'
/tmp/build_35d88t67t7z0x/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:70:in `run'

Thanks.

deadlock; recursive locking (ThreadError)

getting a deadlock. probably related to rack/rack#349

2013-05-18T15:53:12.178584+00:00 app[web.1]: E, [2013-05-18T15:53:12.178598 #4026] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/deflater.rb:13:in call' 2013-05-18T15:53:12.178584+00:00 app[web.1]: E, [2013-05-18T15:53:12.178390 #4026] ERROR -- : app error: deadlock; recursive locking (ThreadError) 2013-05-18T15:53:12.178584+00:00 app[web.1]: E, [2013-05-18T15:53:12.178528 #4026] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/lock.rb:14:incall'
2013-05-18T15:53:12.178584+00:00 app[web.1]: E, [2013-05-18T15:53:12.178572 #4026] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/heroku-deflater-0.5.1/lib/heroku-deflater/skip_binary.rb:19:in call' 2013-05-18T15:53:12.178940+00:00 app[web.1]: E, [2013-05-18T15:53:12.178728 #4026] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:66:incall!'
2013-05-18T15:53:12.178940+00:00 app[web.1]: E, [2013-05-18T15:53:12.178753 #4026] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in call' 2013-05-18T15:53:12.178584+00:00 app[web.1]: E, [2013-05-18T15:53:12.178498 #4026] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/lock.rb:14:inlock'
2013-05-18T15:53:12.178940+00:00 app[web.1]: E, [2013-05-18T15:53:12.178804 #4026] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:223:in call' 2013-05-18T15:53:12.178940+00:00 app[web.1]: E, [2013-05-18T15:53:12.178830 #4026] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:inmethod_missing'
2013-05-18T15:53:12.178584+00:00 app[web.1]: E, [2013-05-18T15:53:12.178550 #4026] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/static.rb:63:in call' 2013-05-18T15:53:12.178584+00:00 app[web.1]: E, [2013-05-18T15:53:12.178624 #4026] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/heroku-deflater-0.5.1/lib/heroku-deflater/serve_zipped_assets.rb:49:incall'
2013-05-18T15:53:12.178584+00:00 app[web.1]: E, [2013-05-18T15:53:12.178676 #4026] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:245:in fetch' 2013-05-18T15:53:12.179179+00:00 app[web.1]: E, [2013-05-18T15:53:12.178984 #4026] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:511:inmaintain_worker_count'
2013-05-18T15:53:12.178940+00:00 app[web.1]: E, [2013-05-18T15:53:12.178856 #4026] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:552:in process_client' 2013-05-18T15:53:12.178584+00:00 app[web.1]: E, [2013-05-18T15:53:12.178702 #4026] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:185:inlookup'
2013-05-18T15:53:12.178940+00:00 app[web.1]: E, [2013-05-18T15:53:12.178881 #4026] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:632:in worker_loop' 2013-05-18T15:53:12.179179+00:00 app[web.1]: E, [2013-05-18T15:53:12.179034 #4026] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/unicorn-4.6.2/bin/unicorn:126:in<top (required)>'
2013-05-18T15:53:12.179179+00:00 app[web.1]: E, [2013-05-18T15:53:12.179060 #4026] ERROR -- : /app/vendor/bundle/ruby/1.9.1/bin/unicorn:19:in load' 2013-05-18T15:53:12.178940+00:00 app[web.1]: E, [2013-05-18T15:53:12.178779 #4026] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:479:incall'
2013-05-18T15:53:12.178584+00:00 app[web.1]: E, [2013-05-18T15:53:12.178650 #4026] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in forward' 2013-05-18T15:53:12.178940+00:00 app[web.1]: E, [2013-05-18T15:53:12.178907 #4026] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.6.2.96/lib/new_relic/agent/instrumentation/unicorn_instrumentation.rb:22:incall'
2013-05-18T15:53:12.179179+00:00 app[web.1]: E, [2013-05-18T15:53:12.179086 #4026] ERROR -- : /app/vendor/bundle/ruby/1.9.1/bin/unicorn:19:in <main>' 2013-05-18T15:53:12.178940+00:00 app[web.1]: E, [2013-05-18T15:53:12.178933 #4026] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.6.2.96/lib/new_relic/agent/instrumentation/unicorn_instrumentation.rb:22:inblock (4 levels) in <top (required)>'
2013-05-18T15:53:12.179179+00:00 app[web.1]: E, [2013-05-18T15:53:12.179009 #4026] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:277:in join' 2013-05-18T15:53:12.178940+00:00 app[web.1]: E, [2013-05-18T15:53:12.178958 #4026] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:500:inspawn_missing_workers'
2013-05-18T15:53:26.475166+00:00 app[web.1]: E, [2013-05-18T15:53:26.474954 #15] ERROR -- : app error: deadlock; recursive locking (ThreadError)
2013-05-18T15:53:26.478327+00:00 app[web.1]: E, [2013-05-18T15:53:26.478232 #15] ERROR -- : /app/vendor/bundle/ruby/1.9.1/bin/unicorn:19:in <main>' 2013-05-18T15:53:26.475539+00:00 app[web.1]: E, [2013-05-18T15:53:26.475454 #15] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/heroku-deflater-0.5.1/lib/heroku-deflater/serve_zipped_assets.rb:49:incall'
2013-05-18T15:53:26.476311+00:00 app[web.1]: E, [2013-05-18T15:53:26.476257 #15] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in call' 2013-05-18T15:53:26.478168+00:00 app[web.1]: E, [2013-05-18T15:53:26.478014 #15] ERROR -- : /app/vendor/bundle/ruby/1.9.1/bin/unicorn:19:inload'
2013-05-18T15:53:26.475166+00:00 app[web.1]: E, [2013-05-18T15:53:26.475064 #15] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/lock.rb:14:in lock' 2013-05-18T15:53:26.476459+00:00 app[web.1]: E, [2013-05-18T15:53:26.476387 #15] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:479:incall'
2013-05-18T15:53:26.477933+00:00 app[web.1]: E, [2013-05-18T15:53:26.477879 #15] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/unicorn-4.6.2/bin/unicorn:126:in <top (required)>' 2013-05-18T15:53:26.475166+00:00 app[web.1]: E, [2013-05-18T15:53:26.475094 #15] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/lock.rb:14:incall'
2013-05-18T15:53:26.475680+00:00 app[web.1]: E, [2013-05-18T15:53:26.475626 #15] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in forward' 2013-05-18T15:53:26.476689+00:00 app[web.1]: E, [2013-05-18T15:53:26.476635 #15] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:inmethod_missing'
2013-05-18T15:53:26.476194+00:00 app[web.1]: E, [2013-05-18T15:53:26.476082 #15] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:66:in call!' 2013-05-18T15:53:26.475390+00:00 app[web.1]: E, [2013-05-18T15:53:26.475212 #15] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/heroku-deflater-0.5.1/lib/heroku-deflater/skip_binary.rb:19:incall'
2013-05-18T15:53:26.475452+00:00 app[web.1]: E, [2013-05-18T15:53:26.475363 #15] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/deflater.rb:13:in call' 2013-05-18T15:53:26.475810+00:00 app[web.1]: E, [2013-05-18T15:53:26.475743 #15] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:245:infetch'
2013-05-18T15:53:26.475966+00:00 app[web.1]: E, [2013-05-18T15:53:26.475874 #15] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:185:in lookup' 2013-05-18T15:53:26.476574+00:00 app[web.1]: E, [2013-05-18T15:53:26.476521 #15] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:223:incall'
2013-05-18T15:53:26.475166+00:00 app[web.1]: E, [2013-05-18T15:53:26.475116 #15] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/static.rb:63:in call' 2013-05-18T15:53:26.477088+00:00 app[web.1]: E, [2013-05-18T15:53:26.476993 #15] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:632:inworker_loop'
2013-05-18T15:53:26.477296+00:00 app[web.1]: E, [2013-05-18T15:53:26.477196 #15] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.6.2.96/lib/new_relic/agent/instrumentation/unicorn_instrumentation.rb:22:in call' 2013-05-18T15:53:26.476925+00:00 app[web.1]: E, [2013-05-18T15:53:26.476829 #15] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:552:inprocess_client'
2013-05-18T15:53:26.477433+00:00 app[web.1]: E, [2013-05-18T15:53:26.477361 #15] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.6.2.96/lib/new_relic/agent/instrumentation/unicorn_instrumentation.rb:22:in block (4 levels) in <top (required)>' 2013-05-18T15:53:26.477610+00:00 app[web.1]: E, [2013-05-18T15:53:26.477534 #15] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:500:inspawn_missing_workers'
2013-05-18T15:53:26.477815+00:00 app[web.1]: E, [2013-05-18T15:53:26.477727 #15] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:142:in `start'

interaction with rails serving .gz files

Thanks for a great project!

the readme says:

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.

I believe rails has done this since 4.2.

I'm wondering if this project interacts with that behavior appropriately. Might be worth mentioning something in the readme. I can put in a PR for that if the discussion here reveals something interesting.

tries to use chomp on array

Not sure where this went wrong:

Unexpected error while processing request: undefined method `chomp' for ["Cache-Control", "public, max-age=604800"]:Array

Seems that chomp doesn't work on arrays but only on strings. Off to fix my weblog now :) will update if I find more (there are only 2 chomps in the code, so should be easy to find

heroku-deflater overwrites production.rb cache-control setting

in config/environments/production.rb, I have the following code:
config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=31536000' }

However, any compressed .js and .css files coming from my Rails app are being served with the header value public, max-age=86400. It appears this gem is overriding the value explicitly set within my app.

Plans to support more comprehensive list

Image file formats supported by the web, as well as videos, PDFs and other binary formats, are already compressed.

Are there plans to include other files besides those starting with images.

Getting "Cache-Control: max-age=0, private, must-revalidate"

I have this in my production.rb:

config.static_cache_control = "public, max-age=31536000"

However, 'curl -i -H "Accept-Encoding: gzip,deflate" https://www.sharemyspace.com', for example (or using a browser) shows this: Cache-Control: max-age=0, private, must-revalidate (Chrome just shows max-age=0) and it does not show that assets are gzipped. gzipped versions are not served.

I'm using Cloudfront.

Any advice? Thanks!

Undefined method `split' for nil:NilClass

I'm getting this exception when requesting any of my assets. The .gz and originals are all present, I'm using cedar with ruby 1.9.3

Stacktrace (most recent call first):

File "rack/cache/cachecontrol.rb", line 185, in parse
  value.delete(' ').split(',').each do |part|
File "rack/cache/cachecontrol.rb", line 8, in initialize
  parse(value)
File "rack/cache/response.rb", line 69, in new
  @cache_control ||= CacheControl.new(headers['Cache-Control'])

Any ideas?

Possible conflict with the latest versions of rack

As of rack 2.1.1 I always get this kind of error:

2020-01-27T17:55:25.393308+00:00 app[web.1]: I, [2020-01-27T17:55:25.393231 #3]  INFO -- : [64d627de-3d78-4643-9fe3-6a8f911cbc5a] Completed 302 Found in 43ms (ActiveRecord: 19.5ms | Allocations: 8776)
2020-01-27T17:55:25.394704+00:00 app[web.1]: 2020-01-27 17:55:25 +0000: Read error: #<NoMethodError: undefined method `each' for nil:NilClass>
2020-01-27T17:55:25.394707+00:00 app[web.1]: /app/vendor/bundle/ruby/2.6.0/gems/rack-2.1.1/lib/rack/deflater.rb:90:in `each'
2020-01-27T17:55:25.394708+00:00 app[web.1]: /app/vendor/bundle/ruby/2.6.0/gems/rack-2.1.1/lib/rack/body_proxy.rb:34:in `each'
2020-01-27T17:55:25.394709+00:00 app[web.1]: /app/vendor/bundle/ruby/2.6.0/gems/rack-2.1.1/lib/rack/body_proxy.rb:34:in `each'
2020-01-27T17:55:25.394711+00:00 app[web.1]: /app/vendor/bundle/ruby/2.6.0/gems/rack-2.1.1/lib/rack/body_proxy.rb:34:in `each'
2020-01-27T17:55:25.394712+00:00 app[web.1]: /app/vendor/bundle/ruby/2.6.0/gems/rack-2.1.1/lib/rack/body_proxy.rb:34:in `each'
2020-01-27T17:55:25.394713+00:00 app[web.1]: /app/vendor/bundle/ruby/2.6.0/gems/rack-2.1.1/lib/rack/body_proxy.rb:34:in `each'
2020-01-27T17:55:25.394715+00:00 app[web.1]: /app/vendor/bundle/ruby/2.6.0/gems/puma-4.3.1/lib/puma/server.rb:814:in `handle_request'
2020-01-27T17:55:25.394716+00:00 app[web.1]: /app/vendor/bundle/ruby/2.6.0/gems/puma-4.3.1/lib/puma/server.rb:472:in `process_client'
2020-01-27T17:55:25.394717+00:00 app[web.1]: /app/vendor/bundle/ruby/2.6.0/gems/puma-4.3.1/lib/puma/server.rb:328:in `block in run'
2020-01-27T17:55:25.394719+00:00 app[web.1]: /app/vendor/bundle/ruby/2.6.0/gems/puma-4.3.1/lib/puma/thread_pool.rb:134:in `block in spawn_thread'

I've also tried the rack/rack@25c5820 version of rack and it gives me the same error.

Removing heroku-deflater from the Gemfile makes the error go away.

Rack::Deflater already has this functionality?

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

Middleware Ordering

The middleware ordering is:

HerokuDeflater::ServeZippedAssets
Rack::Deflater
HerokuDeflater::SkipBinary

Shouldn't SkipBinary be first in this chain rather than last? The other two filters do work that is wasted if SkipBinary kicks in.

After adding gem assets do not load properly

I added this gem in an attempt to compress my assets but after pushing to Heroku, none of my javascript is loading properly. Instead, any jQuery called in views (not in seperate .js file) cause the following error:

Uncaught ReferenceError: $ is not defined

When I rollback Heroku everything runs normally, but any commit that I push up causes the same error (even after uninstalling the gem)

Syntax Error with 0.6.0 and Rails 4.2.4

Hi,
I have just encountered an error while using version 0.6.0 and Rails 4.2.4
I have solved my problem by downgrading to 0.5.3, however I wanted to let you know. [Even though I am not sure if there is actually a problem, or if I made a mistake in my configuration.]

I reproduced the issue by creating a new Rails project, added Heroku Deflater gem v0.6.0 and running >bundle install then >rails s
See extract below:
https://gist.github.com/babgyy/366d8a3362aee8315a2a

Thanks for the gem !
Best regards
Lucas

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.