質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Devise

Deviseとは、Ruby-on-Railsの認証機能を追加するプラグインです。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

AWS(Amazon Web Services)

Amazon Web Services (AWS)は、仮想空間を機軸とした、クラスター状のコンピュータ・ネットワーク・データベース・ストーレッジ・サポートツールをAWSというインフラから提供する商用サービスです。

Q&A

0回答

660閲覧

Rails 本番環境でDeviseのログアウトができない

trrn2011

総合スコア28

Devise

Deviseとは、Ruby-on-Railsの認証機能を追加するプラグインです。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

AWS(Amazon Web Services)

Amazon Web Services (AWS)は、仮想空間を機軸とした、クラスター状のコンピュータ・ネットワーク・データベース・ストーレッジ・サポートツールをAWSというインフラから提供する商用サービスです。

0グッド

1クリップ

投稿2019/05/02 05:56

編集2022/01/12 10:55

Rails 5.0.6
Ruby 2.4.1

deviseでのユーザー認証を実装したwebサービスを本番環境(AWS)にupしたのですが本番環境のみログアウトができない状態となっています

ログアウトボタン <%= link_to 'ログアウト', destroy_user_session_path, method: :delete %>
devise.rb # frozen_string_literal: true # Use this hook to configure devise mailer, warden hooks and so forth. # Many of these configuration options can be set straight in your model. Devise.setup do |config| config.secret_key = Rails.application.secrets.secret_key_base config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com' require 'devise/orm/active_record' config.case_insensitive_keys = [:email] config.strip_whitespace_keys = [:email] config.skip_session_storage = [:http_auth] config.stretches = Rails.env.test? ? 1 : 11 config.reconfirmable = true config.expire_all_remember_me_on_sign_out = true config.password_length = 6..128 config.email_regexp = /\A[^@\s]+@[^@\s]+\z/ config.reset_password_within = 6.hours end
production.rb Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.cache_classes = true # Eager load code on boot. This eager loads most of Rails and # your application in memory, allowing both threaded web servers # and those relying on copy on write to perform better. # Rake tasks automatically ignore this option for performance. config.eager_load = true # Full error reports are disabled and caching is turned on. config.consider_all_requests_local = false config.action_controller.perform_caching = true # Disable serving static files from the `/public` folder by default since # Apache or NGINX already handles this. config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? # Compress JavaScripts and CSS. config.assets.js_compressor = :uglifier # config.assets.css_compressor = :sass # Do not fallback to assets pipeline if a precompiled asset is missed. config.assets.compile = false # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb # Enable serving of images, stylesheets, and JavaScripts from an asset server. # config.action_controller.asset_host = 'http://assets.example.com' # Specifies the header that your server uses for sending files. # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX # Mount Action Cable outside main process or domain # config.action_cable.mount_path = nil # config.action_cable.url = 'wss://example.com/cable' # config.action_cable.allowed_request_origins = [ /http://.*/ ] # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # config.force_ssl = true # Use the lowest log level to ensure availability of diagnostic information # when problems arise. config.log_level = :debug # Prepend all log lines with the following tags. config.log_tags = [ :request_id ] # Use a different cache store in production. # config.cache_store = :mem_cache_store # Use a real queuing backend for Active Job (and separate queues per environment) # config.active_job.queue_adapter = :resque # config.active_job.queue_name_prefix = "link_#{Rails.env}" config.action_mailer.perform_caching = false # Ignore bad email addresses and do not raise email delivery errors. # Set this to true and configure the email server for immediate delivery to raise delivery errors. # config.action_mailer.raise_delivery_errors = false # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation cannot be found). config.i18n.fallbacks = true # Send deprecation notices to registered listeners. config.active_support.deprecation = :notify # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = ::Logger::Formatter.new # Use a different logger for distributed setups. # require 'syslog/logger' # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') if ENV["RAILS_LOG_TO_STDOUT"].present? logger = ActiveSupport::Logger.new(STDOUT) config.action_view.logger = nil logger.formatter = config.log_formatter config.logger = ActiveSupport::TaggedLogging.new(logger) end # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false end
ログ Started DELETE "/users/sign_out" for 116.64.3.13 at 2019-05-02 05:52:26 +0000 I, [2019-05-02T05:52:26.238036 #4078] INFO -- : [1fb87b37-8719-4fdb-b0bd-9cdc10e45ad9] Processing by Devise::SessionsController#destroy as HTML I, [2019-05-02T05:52:26.238088 #4078] INFO -- : [1fb87b37-8719-4fdb-b0bd-9cdc10e45ad9] Parameters: {"authenticity_token"=>"VmgHN2WKM5TroaZScaNcVlcGti0ZPRJfzCB770dFxIlOccJTApx+g75w1oxB3GyWwzsK/76DWlLSA8MVDNM9Aw=="} D, [2019-05-02T05:52:26.239658 #4078] DEBUG -- : [1fb87b37-8719-4fdb-b0bd-9cdc10e45ad9] ^[[1m^[[36mUser Load (0.3ms)^[[0m ^[[1m^[[34mSELECT `users`.* FROM `users` WHERE `users`.`id` = 3 ORDER BY `users`.`id` ASC LIMIT 1^[[0m W, [2019-05-02T05:52:26.240264 #4078] WARN -- : [1fb87b37-8719-4fdb-b0bd-9cdc10e45ad9] Can't verify CSRF token authenticity. D, [2019-05-02T05:52:26.243563 #4078] DEBUG -- : [1fb87b37-8719-4fdb-b0bd-9cdc10e45ad9] ^[[1m^[[35m (0.1ms)^[[0m ^[[1m^[[35mBEGIN^[[0m D, [2019-05-02T05:52:26.261243 #4078] DEBUG -- : [1fb87b37-8719-4fdb-b0bd-9cdc10e45ad9] ^[[1m^[[35m (0.1ms)^[[0m ^[[1m^[[35mCOMMIT^[[0m I, [2019-05-02T05:52:26.262343 #4078] INFO -- : [1fb87b37-8719-4fdb-b0bd-9cdc10e45ad9] Redirected to (トップページ) I, [2019-05-02T05:52:26.262527 #4078] INFO -- : [1fb87b37-8719-4fdb-b0bd-9cdc10e45ad9] Completed 302 Found in 24ms (ActiveRecord: 3.3ms)

ログ上ではうまくいっているように見えるのですが、その後もcurrent_userにuserが残っている状態でログアウトができません

何卒よろしくお願いします

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問