Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #12365 from jbaudanza/reorder

Move Rack::Cache after ActionDispatch::Static in the middleware stack
  • Loading branch information...
commit 2e296c8ee5ddcbd20d7cc80313553148092f77b2 2 parents 5b37036 + 210d0c7
@guilleiguaran guilleiguaran authored
View
10 railties/lib/rails/application/default_middleware_stack.rb
@@ -11,11 +11,6 @@ def initialize(app, config, paths)
def build_stack
ActionDispatch::MiddlewareStack.new.tap do |middleware|
- if rack_cache = load_rack_cache
- require "action_dispatch/http/rack_cache"
- middleware.use ::Rack::Cache, rack_cache
- end
-
if config.force_ssl
middleware.use ::ActionDispatch::SSL, config.ssl_options
end
@@ -26,6 +21,11 @@ def build_stack
middleware.use ::ActionDispatch::Static, paths["public"].first, config.static_cache_control
end
+ if rack_cache = load_rack_cache
+ require "action_dispatch/http/rack_cache"
+ middleware.use ::Rack::Cache, rack_cache
+ end
+
middleware.use ::Rack::Lock unless allow_concurrency?
middleware.use ::Rack::Runtime
middleware.use ::Rack::MethodOverride
View
2  railties/test/application/middleware_test.rb
@@ -61,7 +61,7 @@ def app
boot!
- assert_equal "Rack::Cache", middleware.first
+ assert middleware.include?("Rack::Cache")
end
test "ActiveRecord::Migration::CheckPending is present when active_record.migration_error is set to :page_load" do
Please sign in to comment.
Something went wrong with that request. Please try again.