我想讓https
爲我的rails應用程序工作。當我嘗試在應用程序上執行任何與帖子相關的活動時,我收到以下錯誤消息。HTTPS for Rails應用程序 - InvalidAuthenticityToken
Exception `ActionController::InvalidAuthenticityToken' at /usr/local/rvm/gems/ruby-2.4.1/gems/actionpack-5.0.4/lib/action_controller/metal/request_forgery_protection.rb:195 - ActionCon
troller::InvalidAuthenticityToken
Exception `ActionController::InvalidAuthenticityToken' at /usr/local/rvm/gems/ruby-2.4.1/gems/actionpack-5.0.4/lib/action_controller/metal/rescue.rb:23 - ActionController::InvalidAuthe
nticityToken
Exception `ActionController::InvalidAuthenticityToken' at /usr/local/rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/notifications/instrumenter.rb:25 - ActionController
::InvalidAuthenticityToken
Exception `ActionController::InvalidAuthenticityToken' at /usr/local/rvm/gems/ruby-2.4.1/gems/actionpack-5.0.4/lib/action_dispatch/middleware/callbacks.rb:42 - ActionController::Invali
dAuthenticityToken
Exception `ActionController::InvalidAuthenticityToken' at /usr/local/rvm/gems/ruby-2.4.1/gems/actionpack-5.0.4/lib/action_dispatch/middleware/debug_exceptions.rb:77 - ActionController:
:InvalidAuthenticityToken
你可以發佈你的控制器代碼的副本嗎?你是否在使用任何認證寶石,如Devise?如果是這樣,哪個版本?另外,這項工作沒有SSL嗎? –
@TomAranda它適用於http。當我發佈其發佈到http表單提交從https –
您的整個會話在https上?換句話說,您的所有請求是否加載表單GET並通過https發佈表單?如果不是,那麼rails可能會使用不同的會話,導致真實性令牌失敗。 –