From 6b126ffdcd8031bfe83fc311a230799c05e2c955 Mon Sep 17 00:00:00 2001 From: Matthew Draper Date: Sat, 31 Dec 2016 08:20:35 +1030 Subject: Enforce middleware ordering with a test, instead of comments We want the actual order to be very predictable, so it's rightly defined in code -- not with an on-the-fly tsort. But we can do the tsort here, and then verify that it matches the implemented ordering. This way we don't leave future readers guessing which parts of the ordering are deliberate and which are arbitrary. --- railties/lib/rails/application/default_middleware_stack.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'railties/lib') diff --git a/railties/lib/rails/application/default_middleware_stack.rb b/railties/lib/rails/application/default_middleware_stack.rb index 5ecc7bb7c6..d070aca2dd 100644 --- a/railties/lib/rails/application/default_middleware_stack.rb +++ b/railties/lib/rails/application/default_middleware_stack.rb @@ -41,10 +41,8 @@ module Rails middleware.use ::Rack::Runtime middleware.use ::Rack::MethodOverride unless config.api_only middleware.use ::ActionDispatch::RequestId - middleware.use ::ActionDispatch::RemoteIp, config.action_dispatch.ip_spoofing_check, config.action_dispatch.trusted_proxies - # Must come after Rack::MethodOverride to properly log overridden methods - # Must come after ActionDispatch::RemoteIP to properly log ip address + middleware.use ::Rails::Rack::Logger, config.log_tags middleware.use ::ActionDispatch::ShowExceptions, show_exceptions_app middleware.use ::ActionDispatch::DebugExceptions, app, config.debug_exception_response_format -- cgit v1.2.3