I am using sidekiq 4.1.4 with Rails 4.2.6.
The route file has below code:
require 'sidekiq/web'
mount Sidekiq::Web, at: '/sidekiq'
When I access sidekiq UI through http://localhost:3000/sidekiq , it shows error:
{
"errors": [
"Unauthorized Request"
]
}
I'm using warden authentication and the initializer file has this code:
Rails.application.config.middleware.insert_after ActionDispatch::ParamsParser, Warden::Manager do |manager|
manager.default_strategies :authentication_token
manager.failure_app = UnauthenticatedController
end
I was able to access sidekiq at http://my_domain.com/sidekiq with these changes:
Create an initializer with below code:
class MountedAppAuth
def initialize( app )
@app = app
end
def call( env )
@app.call( env )
end
end
In routes.rb:
require 'sidekiq/web'
Sidekiq::Web.use MountedAppAuth
mount Sidekiq::Web, at: '/sidekiq'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.