0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

RailsAPIモードでSidekiqダッシュボードのPOST操作がForbbidenになる

0
Last updated at Posted at 2026-03-12

症状

  • Sidekiqダッシュボードでジョブの再試行・削除などPOST操作を行うと403 Forbiddenと出てしまい操作できない

原因

APIモードではセッション関連のミドルウェアがデフォルトで含まれない。
Sidekiq::WebのCSRF保護はセッションにトークンを保存するが、ActionDispatch::Cookiesがないためセッションが機能せずCSRF検証に失敗する。

対策

config/application.rbActionDispatch::Cookies ミドルウェアを追加する。

# config/application.rb
config.middleware.use ActionDispatch::Cookies
config.middleware.use ActionDispatch::Session::CookieStore, key: '_app_session'
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?