Rails App hosted in heroku, with Cloudfront, giving net::ERR_INVALID_CHUNKED_ENCODING

195 views Asked by At

When i try to serve Gzipped assets, i'm getting net::ERR_INVALID_CHUNKED_ENCODING randomly in my assets. Now I'm using Rack zippy gem, I've tried to use Rack deflate and gives the same error. My cloudfront is pointing to Heroku. More info and relevant source codes:

$ rake middleware

use Honeybadger::Rack::UserInformer
use Honeybadger::Rack::UserFeedback
use Honeybadger::Rack::ErrorNotifier
use Rack::Sendfile
use Rack::Zippy::AssetServer
use Rack::Lock
use #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x00000008358600>
(...)

config.ru

# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment',  __FILE__)
use Rack::Chunked
use Rack::Deflater
run Soprojetos::Application

initializer rack_zippy.ru

Rails.application.config.middleware.swap(ActionDispatch::Static, Rack::Zippy::AssetServer)

Rack::Zippy.configure do |config|
  config.static_extensions << 'xml'
end

enviroments/production.rb

(...)
  config.assets.compress = true
  # Disable Rails's static asset server (Apache or nginx will already do this).
  config.serve_static_assets = true

  # Compress JavaScripts and CSS.
  config.assets.js_compressor = :uglifier
  # config.assets.css_compressor = :sass

  # Do not fallback to assets pipeline if a precompiled asset is missed.
  config.assets.compile = false

  # Generate digests for assets URLs.
  config.assets.digest = true

  (...)

  config.middleware.use Rack::Attack

  config.middleware.insert_before ActionDispatch::Static, Rack::SSL, :exclude => proc { |env| env['HTTPS'] != 'on' }
(...)
0

There are 0 answers