我有正在生产的Rails项目。 但是在localhost上,它会在每个POST请求中引发ActionController::InvalidAuthenticityToken
。我知道它是什么。 AuthToken可防止csrf攻击。我在我的application_controller.rbrails protect_from_forgery引发异常
protect_from_forgery with: :exception #this line raise exception
和csrf_meta_tags
存在。 我在其他Rails项目中没有任何问题。
如果我删除参数with: :exception
会话将在重新加载页面后重置。
是什么问题?
此参数重置会话。 '''protect_from_forgery'''默认具有'''::null_session'''。 – 2015-01-21 05:24:58