0

我有一个部署在 AWS 服务器上的 rails 应用程序。但是,在用户登录期间,我不断收到此错误。

F, [2022-01-08T04:27:07.890457 #12] FATAL -- : [e8f8a95f-4298-491b-818e-419e8cd54508]
F, [2022-01-08T04:27:07.890561 #12] FATAL -- : [e8f8a95f-4298-491b-818e-419e8cd54508] ActionController::InvalidAuthenticityToken (ActionController::InvalidAuthenticityToken):
F, [2022-01-08T04:27:07.890601 #12] FATAL -- : [e8f8a95f-4298-491b-818e-419e8cd54508]
F, [2022-01-08T04:27:07.890650 #12] FATAL -- : [e8f8a95f-4298-491b-818e-419e8cd54508] actionpack (5.1.5) lib/action_controller/metal/request_forgery_protection.rb:195:in `handle_unverified_request'
[e8f8a95f-4298-491b-818e-419e8cd54508] actionpack (5.1.5) lib/action_controller/metal/request_forgery_protection.rb:227:in `handle_unverified_request'
[e8f8a95f-4298-491b-818e-419e8cd54508] devise (4.4.1) lib/devise/controllers/helpers.rb:255:in `handle_unverified_request'
[e8f8a95f-4298-491b-818e-419e8cd54508] actionpack (5.1.5) lib/action_controller/metal/request_forgery_protection.rb:222:in `verify_authenticity_token'
[e8f8a95f-4298-491b-818e-419e8cd54508] activesupport (5.1.5) lib/active_support/callbacks.rb:413:in `block in make_lambda'
[e8f8a95f-4298-491b-818e-419e8cd54508] activesupport (5.1.5) lib/active_support/callbacks.rb:197:in `block (2 levels) in halting'
[e8f8a95f-4298-491b-818e-419e8cd54508] actionpack (5.1.5) lib/abstract_controller/callbacks.rb:12:in `block (2 levels) in <module:Callbacks>'
[e8f8a95f-4298-491b-818e-419e8cd54508] activesupport (5.1.5) lib/active_support/callbacks.rb:198:in `block in halting'
[e8f8a95f-4298-491b-818e-419e8cd54508] activesupport (5.1.5) lib/active_support/callbacks.rb:507:in `block in invoke_before'
[e8f8a95f-4298-491b-818e-419e8cd54508] activesupport (5.1.5) lib/active_support/callbacks.rb:507:in `each'
[e8f8a95f-4298-491b-818e-419e8cd54508] activesupport (5.1.5) lib/active_support/callbacks.rb:507:in `invoke_before'
[e8f8a95f-4298-491b-818e-419e8cd54508] activesupport (5.1.5) lib/active_support/callbacks.rb:106:in `block in run_callbacks'

我尝试使用在生产模式下运行的相同设置在本地服务器上复制项目,但没有发生错误。它只显示在实际服务器上,而不是我的本地机器上。

我将 docker 与 docker-compose、rails 5.1、ruby 2.5 和设计一起使用。

我有=csrf_meta_tags我的layouts/application

doctype html
html lang="ja" 
  head
    meta content=("text/html; charset=UTF-8") http-equiv="Content-Type" /
    = display_meta_tags
    = stylesheet_link_tag "application", :media => "all"
    = javascript_include_tag 'application'
    script charset="UTF-8" src="https://ajaxzip3.github.io/ajaxzip3.js"
    = favicon_link_tag
    = csrf_meta_tags

这是我的一些内容application_controller.rb

  class ApplicationController < ActionController::Base
    protect_from_forgery with: :exception
    before_action :authenticate_agent!
    before_action :alert_count, if: :agent_signed_in?
    include HttpAuthConcern
4

0 回答 0