Rails 5 Protect Sidekiq UI

Viewed 923

I'm trying to protect the Sidekiq UI with Devise. I'm running Rails 5.1, Devise 4.3 and Sidekiq 5.0. I tried the following post:

How can I password-protect my /sidekiq route (i.e. require authentication for the Sidekiq::Web tool)?

but I get the following error:

Undefined method failure_app for nil:NilClass

My routes file looks like this:

Rails.application.routes.draw do
  constraint = lambda do |request|
    request.env['warden'].authenticate!({ scope: :admin_user })
  end

  constraints constraint do
    mount Sidekiq::Web => '/admin/sidekiq'
  end

  devise_for :users
  resources :users
end

How can I protect Sidekiq UI with Devise on Rails 5.1?

1 Answers
Related