aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/middleware/static.rb
diff options
context:
space:
mode:
authorAndrew White <andyw@pixeltrix.co.uk>2012-12-06 17:06:59 +0000
committerAndrew White <andyw@pixeltrix.co.uk>2012-12-06 17:20:53 +0000
commitc59734f756b79c39486c45273d2cc5d42cd0c864 (patch)
tree3fc32497850a341872b896c09a0c065f218b18d8 /actionpack/lib/action_dispatch/middleware/static.rb
parent5a8f25f003f022ebc6986b20b0c10329e9553dc3 (diff)
downloadrails-c59734f756b79c39486c45273d2cc5d42cd0c864.tar.gz
rails-c59734f756b79c39486c45273d2cc5d42cd0c864.tar.bz2
rails-c59734f756b79c39486c45273d2cc5d42cd0c864.zip
Invert precedence of content in ActionDispatch::Static
This commit inverts the precedence in ActionDispatch::Static so that dynamic content will be served before static content. This is so that precompiled assets do not inadvertently get included when running in development mode - it should have no effect in production where static files are usually handled by the web server. Closes #6421
Diffstat (limited to 'actionpack/lib/action_dispatch/middleware/static.rb')
-rw-r--r--actionpack/lib/action_dispatch/middleware/static.rb18
1 files changed, 11 insertions, 7 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/static.rb b/actionpack/lib/action_dispatch/middleware/static.rb
index e3b15b43b9..65670b0ff1 100644
--- a/actionpack/lib/action_dispatch/middleware/static.rb
+++ b/actionpack/lib/action_dispatch/middleware/static.rb
@@ -51,16 +51,20 @@ module ActionDispatch
end
def call(env)
- case env['REQUEST_METHOD']
- when 'GET', 'HEAD'
- path = env['PATH_INFO'].chomp('/')
- if match = @file_handler.match?(path)
- env["PATH_INFO"] = match
- return @file_handler.call(env)
+ path = env['PATH_INFO'].chomp('/')
+ response = @app.call(env)
+
+ if response[1]['X-Cascade'] == 'pass'
+ case env['REQUEST_METHOD']
+ when 'GET', 'HEAD'
+ if match = @file_handler.match?(path)
+ env["PATH_INFO"] = match
+ return @file_handler.call(env)
+ end
end
end
- @app.call(env)
+ response
end
end
end