Where to insert Rack::Deflater in the rack?

前端 未结 3 1892
伪装坚强ぢ
伪装坚强ぢ 2021-02-04 06:50

I currently have the following:

use Rack::Rewrite
use Rack::Cache, {:verbose=>true, :metastore=>\"memcached://localhost:11211/rack-cache/meta\", :entitysto         


        
3条回答
  •  天命终不由人
    2021-02-04 07:34

    I had to insert it pretty early (before ActionDispatch::Static), like this:

    # production.rb
    config.middleware.insert_before ActionDispatch::Static, Rack::Deflater
    

    You can use rake middleware to confirm (although this will look at your development settings)

    > rake middleware
    use Rack::Deflater
    use ActionDispatch::Static
    use Rack::Lock
    use #
    use Rack::Runtime
    use Rack::MethodOverride
    use ActionDispatch::RequestId
    use Rails::Rack::Logger
    use ActionDispatch::ShowExceptions
    use ActionDispatch::DebugExceptions
    use ActionDispatch::RemoteIp
    use ActionDispatch::Reloader
    use ActionDispatch::Callbacks
    use ActionDispatch::Cookies
    use ActionDispatch::Session::CookieStore
    use ActionDispatch::Flash
    use ActionDispatch::ParamsParser
    use Remotipart::Middleware
    use ActionDispatch::Head
    use Rack::ConditionalGet
    use Rack::ETag
    use ActionDispatch::BestStandardsSupport
    use Warden::Manager
    use Rack::Mongoid::Middleware::IdentityMap
    use Rack::Pjax
    run MyApp::Application.routes
    

提交回复
热议问题