遇到一个奇怪的问题,Rack::ShowExceptions
在生产环境中为我的 rails 4.0.4 应用程序呈现详细的异常。添加一个config.middleware.delete(Rack::ShowExceptions)
toconfig/application.rb
仍然设法导致Rack::ShowExceptions
模板被渲染,因此我希望有一些中间件依赖潜伏。
%
例如,在请求中使用未转义的应用程序POST
会导致Rack::ShowExceptions
呈现模板:
示例无效POST
请求:
POST /en/users/sign_in HTTP/1.1
Host: www.localhost.dev
Proxy-Connection: keep-alive
Content-Length: 1
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Origin: http://www.localhost.dev
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip,deflate
Accept-Language: en-US,en;q=0.8
%
机架中间件:
$ RAILS_ENV=production rake middleware
use Raven::Rack
use HttpMethodNotAllowed
use ActionDispatch::SSL
use Rack::Sendfile
use ActionDispatch::Static
use #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x007feba5b8b940>
use Rack::Runtime
use Rack::MethodOverride
use ActionDispatch::RequestId
use RequestStore::Middleware
use Rails::Rack::Logger
use ActionDispatch::ShowExceptions
use ActionDispatch::DebugExceptions
use ActionDispatch::RemoteIp
use ActionDispatch::Callbacks
use ActiveRecord::ConnectionAdapters::ConnectionManagement
use ActiveRecord::QueryCache
use ActionDispatch::Cookies
use ActionDispatch::Session::CookieStore
use ActionDispatch::Flash
use ActionDispatch::ParamsParser
use Rack::Head
use Rack::ConditionalGet
use Rack::ETag
use Warden::Manager
run MyApplication::Application.routes
如果这是相关的,config.exceptions_add = self.routes
我们有。config/application.rb
我已经仔细阅读了 ActionPack CHANGELOG,但这个问题很可能已在以后的版本中得到修复!如果是这样,我将不胜感激。