How can I password-protect my /sidekiq route (i.e. require authentication for the Sidekiq::Web tool)?
问题 I am using sidekiq in my rails application. By Default, Sidekiq can be accessed by anybody by appending "/sidekiq" after the url. I want to password protect / authenticate only the sidekiq part. How can i do that? 回答1: Put the following into your sidekiq initializer require 'sidekiq' require 'sidekiq/web' Sidekiq::Web.use(Rack::Auth::Basic) do |user, password| [user, password] == ["sidekiqadmin", "yourpassword"] end And in the routes file: authenticate :user do mount Sidekiq::Web => '/sidekiq