【发布时间】:2018-05-04 23:50:07
【问题描述】:
我的服务器受到对我的根路径的零星 OPTIONS 请求的攻击。这些都是试图寻找漏洞的机器人。我想返回 404 not found 而不是引发错误,因为我的错误跟踪服务一直都在受到攻击。
我尝试过使用:
options '/', to: 'application#return_not_found'
正确路由这些请求,但是 Rails 5 给了我一个错误。
【问题讨论】:
-
Rails 给出了什么错误?
-
错误是:
undefined method 'options' for #<ActionDispatch::Routing::Mapper:0x007f8ee2b57a20> (NoMethodError)
标签: ruby-on-rails