Ruby version: 2.3.1
Sidekiq / Pro / Enterprise version(s): Sidekiq
Rails: 5.0.0
We have an app which uses sidekiq monitoring described in routes.rb as follows:
authenticate :user do
mount Sidekiq::Web => '/sidekiq'
end
But accessing the '/sidekiq' page logs the user out of devise by creating a new session.
This used to work for us when we were using Rails 4.2 a few weeks back and it still does with Rails 4.2
I don't know what would cause this. You might have better luck asking on StackOverflow.
I received an answer on stackoverflow.
The solution is to enclose authenticate :user in devise_scope :user
devise_scope :user do
authenticate :user do
mount Sidekiq::Web => '/sidekiq'
end
end
This devise_scope :user is needed in Rails 5.0.0 but not in Rails 4.x.x
Thanks for your reply.
Thank you for following up!
Confirmed this is also an issue on Ruby 2.3.1, Rails 4.2.7.1, cancan 1.12, rolify 5.1
User with :database_authenticatable, :registerable, :recoverable, :rememberable, :validatable
The great solution by @nikhilm492 work for these versions as well. Thank you!
Most helpful comment
I received an answer on stackoverflow.
The solution is to enclose authenticate :user in devise_scope :user
devise_scope :user do
authenticate :user do
mount Sidekiq::Web => '/sidekiq'
end
end
This devise_scope :user is needed in Rails 5.0.0 but not in Rails 4.x.x
Thanks for your reply.