如何根据子域更改protect_from_forgery?

时间:2014-05-10 18:07:25

标签: ruby-on-rails-4 subdomain csrf-protection

所以这个问题有两个部分,但可以通过检测ApplicationController中的子域来解决。

我计划使用的解决方案是:

if request.subdomain == 'api'
    protect_from_forgery with: :null_session
else
    protect_from_forgery with: :exception
end

但是request没有得到解决......我得到了这个:

undefined local variable or method `request' for ApplicationController:Class

0 个答案:

没有答案
相关问题