# config.ru require 'rack/protection' use Rack::Protection run MyApp
通过回复代码:
module YouApp class Application < Rails::Application config.mIDdleware.use Rack::Protection::SessionHijacking
我把它放到我的application.rb中,仍然得到内部服务错误,你需要在Rack :: Protection :: SessionHijacking之前设置一个会话中间件
这是rake中间件的输出:
use Rack::MiniProfileruse Actiondispatch::Staticuse Rack::Lockuse #<ActiveSupport::Cache::Strategy::LocalCache::MIDdleware:0x007f9482a28910>use Rack::Runtimeuse Rack::MethodoverrIDeuse Actiondispatch::RequestIDuse Rails::Rack::Loggeruse Actiondispatch::ShowExceptionsuse Actiondispatch::DeBUGExceptionsuse Actiondispatch::RemoteIpuse Actiondispatch::Reloaderuse Actiondispatch::Callbacksuse ActiveRecord::ConnectionAdapters::ConnectionManagementuse ActiveRecord::queryCacheuse Actiondispatch::cookiesuse ActiveRecord::SessionStoreuse Actiondispatch::Flashuse Actiondispatch::ParamsParseruse Actiondispatch::headuse Rack::ConditionalGetuse Rack::ETaguse Actiondispatch::BestStandardsSupportuse Warden::Manageruse Rack::Protection::SessionHijackinguse MetaRequest::MIDdlewares::MetaRequestHandleruse MetaRequest::MIDdlewares::headersuse MetaRequest::MIDdlewares::AppRequestHandleruse OmniAuth::StrategIEs::Twitteruse OmniAuth::StrategIEs::Facebookrun Myapp::Application.routes
感谢任何人可以帮助和感谢您的时间.
解决方法 第1步是从Rack :: Protection包中排除SessionHijacking中间件:# config.rurequire 'rack/protection'use Rack::Protection,:except => :session_hijacking...run YourApp
这将解决问题 – 但我认为你真的想要这个反劫持功能:
步骤2.在Rails application.rb中添加中间件
module YouApp class Application < Rails::Application config.mIDdleware.use Rack::Protection::SessionHijacking ...
通过这种方式,您可以在rails拥有会话中间件 – Actiondispatch :: Session :: cookieStore之后加载它.
您可以通过运行rake中间件来检查结果
总结以上是内存溢出为你收集整理的ruby-on-rails – rails机架保护用法,错误“你需要在* Rack :: Protection :: SessionHijacking之前设置会话中间件*全部内容,希望文章能够帮你解决ruby-on-rails – rails机架保护用法,错误“你需要在* Rack :: Protection :: SessionHijacking之前设置会话中间件*所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)