class Rails::Railtie::Configuration

def app_middleware

created
application once it is defined and the default_middlewares are
All operations you run on the app_middleware will be replayed on the

This allows you to modify the application's middlewares from Engines.
def app_middleware
  @@app_middleware ||= Rails::Configuration::MiddlewareStackProxy.new
end